Solved

Set state of toolbar button?

Posted on 2001-08-17
1
676 Views
Last Modified: 2013-11-20
Hi and thank for your time to read my question,

I am using VC6, I have a workspace: CMyApp, and have a toolbar in CMainFrame. I want to set the button of this toolbar to HIDDEN from CMyAppView class, or CMyAppDoc class, but I don't know how the way.

I tried declare a static CToolbar's variable at CMainForm, and in CMyAppView, I call this static variable for my purpose, but not successful.

Pls help me.
Best regards and thanks in advance.
0
Comment
Question by:vinhdh
1 Comment
 

Accepted Solution

by:
resham earned 50 total points
ID: 6399781
Hi,

You can access MainFrame's members in ur application by calling AfxGetMainWnd().

Here is the sample code
In view class

CMainFrame *pMainFrm = (CMainFrame*) AfxGetMainWnd();
CToolBar& toolBar = pMainFrm->GetToolBar();
CToolBarCtrl& tbCtrl = toolBar.GetToolBarCtrl();

//To hide the  button
tbCtrl.HideButton(ID_FILE_PRINT, FALSE);

And in MainFrame Class
CToolBar& CMainFrame::GetToolBar()
{
     return m_wndToolBar;
}


Hope this will help.

Resham

0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
repeateFront java challenge 31 94
Expand LInux Boot partition remotly 3 96
Separate into files by filename 12 87
Excel Use VBA to get user's Mac Address for their computer 5 251
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question