Solved

How to access toolbar buttons from View class??

Posted on 2001-06-22
8
343 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
  • 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 30 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
bobThere java chalenge 45 92
method notes when mouse over in eclipse 5 87
scoreUp challenge 14 63
wordmultiple challenge 12 136
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

803 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