Print Page | Close Window

Updating toolbar button state

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=19924
Printed Date: 17 July 2025 at 3:29pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Updating toolbar button state
Posted By: dearvivekkumar
Subject: Updating toolbar button state
Date 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




Replies:
Posted By: mgampi
Date 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


Posted By: sharky
Date 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;
}



Posted By: dearvivekkumar
Date 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.


Posted By: dearvivekkumar
Date Posted: 25 July 2012 at 11:51am
Even I am not getting call  to WM_KICKIDLE handler? 

is there some thing I am missing??



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net