Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Updating toolbar button state
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Updating toolbar button state

 Post Reply Post Reply
Author
Message
dearvivekkumar View Drop Down
Newbie
Newbie


Joined: 13 June 2012
Location: New Delhi
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote dearvivekkumar Quote  Post ReplyReply Direct Link To This Post Topic: Updating toolbar button state
    Posted: 06 July 2012 at 4:22am

Hi,

I have a dialog in MFC application, which was having menu-bar. Now I have created a toolbar (CXTPToolBar) in that dialog using the same command which is in the menu-bar.

I use to update the menu-item's state(enable/disable) as per some check in ON_UPDATE_COMMAND_UII handler.

My doubt is when the ON_UPDATE_COMMAND_UII handler gets called by the framework for updating the toolbar buttons state. Since, I am not getting call to this function and it's only get called when i clicks on menubar to popup the menu-items.

Moreover, call to ON_UPDATE_COMMAND_UI is only coming when I click on the toolbar button.

What is the correct way for doing this? Is there some alternative for doing this?

Thanks

Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1201
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Posted: 09 July 2012 at 6:52am
Hi;

Take a look at

Samples\CommandBars\DialogSample

It shows how to get the ON_UPDATE_COMMAND_UI handlers to work.
Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022
Back to Top
sharky View Drop Down
Newbie
Newbie


Joined: 07 January 2009
Location: Czech Republic
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote sharky Quote  Post ReplyReply Direct Link To This Post Posted: 14 July 2012 at 2:08pm
You can force update your toolbar from WM_KICKIDLE message handler

for example:

ON_MESSAGE(WM_KICKIDLE, &CDlg::OnKickIdle)

LRESULT CDlg::OnKickIdle(WPARAM, LPARAM)
{
    SendMessageToDescendants(WM_IDLEUPDATECMDUI);

    return 0;
}

Back to Top
dearvivekkumar View Drop Down
Newbie
Newbie


Joined: 13 June 2012
Location: New Delhi
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote dearvivekkumar Quote  Post ReplyReply Direct Link To This Post Posted: 25 July 2012 at 11:14am
I have tried WM_KICKIDLE, still I'm not getting call on the update handler for the toolbar.

One more thing, the toolbar is on modaless dialog in fact in docking pane. And i'm getting call to Update handler  only when I click on the toolbar button. And after that on command event handler.
Back to Top
dearvivekkumar View Drop Down
Newbie
Newbie


Joined: 13 June 2012
Location: New Delhi
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote dearvivekkumar Quote  Post ReplyReply Direct Link To This Post Posted: 25 July 2012 at 11:51am
Even I am not getting call  to WM_KICKIDLE handler? 

is there some thing I am missing??
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.047 seconds.