Enable/Disable buttons in CXTPToolBar |
Post Reply |
Author | |
zeiga
Newbie Joined: 21 March 2011 Location: United States Status: Offline Points: 7 |
Post Options
Thanks(0)
Posted: 21 March 2011 at 5:55pm |
I created a CXTPToolBar with several buttons. One of the buttons is "Action", and its handler is OnAction(). Here is my problem: After OnAction() is executed, all the buttons on the toolbar seem to be reset and enabled!
A self-written method RefreshToolBarButtons() is called at the end of OnAction() function to update the enable/disable status of all the buttons. (Yes, for some reason, I didn't use ON_UPDATE_COMMAND_UI handler.) I expect all the buttons should be disabled after calling RefreshToolBarButtons() because the visual studio debugger stepped through the following: {.... CXTPControl* pButtonAction = pToolBar->GetControls()->FindControl(xtpControlButton, ID_ACTION, TRUE, FALSE); CXTPControl* pButtonAnotherAction = pToolBar->GetControls()->FindControl(xtpControlButton, ID_ANOTHER_ACTION, TRUE, FALSE); pButtonAction->SetEnabled(FALSE); pButtonAnother->SetEnabled(FALSE); .... } Note: I tried several ways, but it still does not work.
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
If you don't use handler you must set special flag to ignore it:
pControl->SetFlags(xtpFlagManualUpdate);
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
zeiga
Newbie Joined: 21 March 2011 Location: United States Status: Offline Points: 7 |
Post Options
Thanks(0)
|
It works, thanks a lot.
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |