• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 587
  • Last Modified:

CToolbar with dynamic buttons problem

Hi to all,

I have to create a toolbar where the buttons are to be inserted dynamically by the applicartion.

Adding these buttons is not the problem but these buttons are grayed and can not be enabled using the EnableButton function from class CToolBarCtrl.

If I set the button ID to an existing menu ID which is mapped, then the button is enabled but my IDs are dynamic and windows is making a process which disable buttons because no function is mapped.

The mapping is done in the OnCommand function of my Main Frame.

Any idea to avoid windows to disable these buttons and let me handle it my self ?
0
mike_marquet
Asked:
mike_marquet
  • 4
  • 2
1 Solution
 
AndyAinscowCommented:
OnCommandUpdateUI handlers?
0
 
mike_marquetAuthor Commented:
Where can I find it. If I search the class wizard, not displayed.

Find nothing about it in MSDN !

Is it compatible with CMDIFrameWnd ?
0
 
mike_marquetAuthor Commented:
I have found OnUpdateCmdUI which is pure virtual.

Second parameter is bDisableIfNoHandler.

Will try to subclass a derived CTollbar class and check if it works setting this parameter to TRUE
0
Industry Leaders: 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!

 
mike_marquetAuthor Commented:
OK it's working when using a derived class of CToolBar and handle the OnUpdateCmdUI like this :

void CMyToolBar::OnUpdateCmdUI(CFrameWnd *pTarget, BOOL bDisableIfNoHandler)
 {
  CToolBar::OnUpdateCmdUI(pTarget, FALSE);
 }
0
 
mike_marquetAuthor Commented:
Has accepted answer because set me on the way
0
 
AndyAinscowCommented:
Thanks for the points.
0

Featured Post

Technology Partners: 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!

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now