Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to access toolbar buttons from View class??

Posted on 2001-06-22
8
Medium Priority
?
375 Views
Last Modified: 2013-11-20
The title is the question... how to access toolbar buttons from the View class??? can I just simply take a reference to my main frame class and make calls from that??
0
Comment
Question by:techpage
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 3

Author Comment

by:techpage
ID: 6220808
ps: I need to gain access to the toolbar buttons in order to change its checke/uncheck and enable/disable states...
0
 
LVL 2

Accepted Solution

by:
Chandra V earned 120 total points
ID: 6221137
Add a member function to the 'CMainFrame' class as shown below:

CToolBarCtrl& GetToolBarCtrl(){ return m_wndToolBar.GetToolBarCtrl();};

Use this in your view class by using the following(->include the 'MainFrm.h' file)

CMainFrame* pFrame = (CMainFrame*)AfxGetMainWnd();
CToolBarCtrl* pCtrl = pFrame->GetToolBarCtrl();

No you can do what ever you want to do with the toolbar by using the functions like 'CheckButton', 'PressButton', 'EnableButton' etc...
0
 
LVL 3

Author Comment

by:techpage
ID: 6221163
Hello, I've tried what you proposed...

but there is one error:

error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'class CToolBarCtrl' (or there is no acceptable conversion)

I don't know how to solve that...
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 2

Expert Comment

by:Chandra V
ID: 6221170
Sorry, I have typed it wrong

'CTollBarCtrl&' instead of 'CToolBarCtrl*'
0
 
LVL 3

Author Comment

by:techpage
ID: 6221171
Hello, I've tried what you proposed...

but there is one error:

error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'class CToolBarCtrl' (or there is no acceptable conversion)

I don't know how to solve that...
0
 
LVL 2

Expert Comment

by:Chandra V
ID: 6221172
CToolBarCtrl& pCtrl = pFrame->GetToolBarCtrl();
0
 
LVL 3

Author Comment

by:techpage
ID: 6221175
error C2758: 'pTBCtrl' : must be initialized in constructor base/member initializer list

what does this mean??
0
 
LVL 2

Expert Comment

by:Chandra V
ID: 6223845
Hai techpage,

Here is another simple method.

CToolBar * pToolBar = (CToolBar* ) AfxGetMainWnd()->GetDescendantWindow(AFX_IDW_TOOLBAR);
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

610 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