![]() |
BackstageView & CommandUpdate Mechanism |
Post Reply ![]() |
Author | |
MGebler ![]() Groupie ![]() Joined: 18 May 2006 Location: Germany Status: Offline Points: 64 |
![]() ![]() ![]() ![]() ![]() Posted: 24 February 2011 at 2:24pm |
Is it possible to use the 'MFC Updating Command Mechanism' (ON_UPDATE_COMMAND_UI) for the commands and tabs, which were added by the AddCommand and AddTab methods?
A quick look inside the CXTPRibbonBackstageView implementation shows up that this general feature is not supported. Even a hard coded version does not work: CXTPControl* p = pView->AddCommand(ID_FILE_SAVE); p->SetEnabled( FALSE ); Am I wrong or was this feature simple forgotten? Thanks |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hi,
yes, Update handler and Enabled property is not implemented for Backstage buttons.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
MGebler ![]() Groupie ![]() Joined: 18 May 2006 Location: Germany Status: Offline Points: 64 |
![]() ![]() ![]() ![]() ![]() |
Are there any plans to implement this feature?
|
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
yes, already done for 15.0.2
Thanks for these points
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
cpede ![]() Senior Member ![]() Joined: 13 August 2004 Location: Denmark Status: Offline Points: 680 |
![]() ![]() ![]() ![]() ![]() |
Hi Oleg,
Could you please provide a small code example. If I assign a button to a command id handled by the normal command routing, it is not working?
-cpede
|
|
Product: Xtreme ToolkitPro (24.0.0)
Platform: Windows 10 (x64) Language: Visual Studio 2017 (C++) |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
What not working ?
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
cpede ![]() Senior Member ![]() Joined: 13 August 2004 Location: Denmark Status: Offline Points: 680 |
![]() ![]() ![]() ![]() ![]() |
If I add the ID of an existing control to a backstage button, it does not automatically use the command routing already existing. Enabling and disabling the control etc.
If I add a ON_UPDATE_COMMAND_UI handler to my backstage page for e.g. a button, it is not called.
-cpede
|
|
Product: Xtreme ToolkitPro (24.0.0)
Platform: Windows 10 (x64) Language: Visual Studio 2017 (C++) |
|
![]() |
|
MGebler ![]() Groupie ![]() Joined: 18 May 2006 Location: Germany Status: Offline Points: 64 |
![]() ![]() ![]() ![]() ![]() |
If you implement the command handling with
BEGIN_MESSAGE_MAP(CBackstagePage, CXTPRibbonBackstagePage) ON_COMMAND_EX(IDC_BUTTON,OnCommand) ON_UPDATE_COMMAND_UI(IDC_BUTTON,OnUpdateCommand) END_MESSAGE_MAP() the OnCommand mechanism works fine but the update handler OnUpdateCommand is never called. With best regards Marcus |
|
![]() |
|
leeyn ![]() Newbie ![]() Joined: 18 March 2011 Status: Offline Points: 5 |
![]() ![]() ![]() ![]() ![]() |
great news.... ![]() |
|
![]() |
|
MGebler ![]() Groupie ![]() Joined: 18 May 2006 Location: Germany Status: Offline Points: 64 |
![]() ![]() ![]() ![]() ![]() |
Another
problem in paradise. Although the CXTPRibbonBackstagePage inherits from CXTPResizePropertyPage the methods ‘OnSetActive’ and ‘OnKillActive’ are never called. The approach to use the the OnShowWindow method works only for the case that the page becomes inactive. So we patched the CXTPRibbonBackstageView::SetActiveTab method and handle the notification inside each backstage page. if (pNewContent) { /* *** */ pOldContent->SendMessage( WM_NOTIFY, PSN_KILLACTIVE, NULL ); /* *** */ pOldContent->ShowWindow(SW_HIDE); pOldContent->SetParent(GetSite()); } Is there a better solution? With best regards Marcus |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Thanks, we will add something like it also.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
cpede ![]() Senior Member ![]() Joined: 13 August 2004 Location: Denmark Status: Offline Points: 680 |
![]() ![]() ![]() ![]() ![]() |
In v17.2.0 you now call both OnSetActive and OnKillActive.
But you forgot to implement the return value for OnKillActive correctly. If returning FALSE I would expect that the backstage page would not close. This could be a way to prevent the page from changing if e.g. something needs to be addresses before closing. Or is there another way to prevent the page from closing? -cpede
|
|
Product: Xtreme ToolkitPro (24.0.0)
Platform: Windows 10 (x64) Language: Visual Studio 2017 (C++) |
|
![]() |
|
olebed ![]() Admin Group ![]() Joined: 01 July 2014 Location: Ukraine Status: Offline Points: 841 |
![]() ![]() ![]() ![]() ![]() |
Hello cpede,
I have added appropriate changes
Thank you to bringing this to our attention. Regards, Oleksandr Lebed |
|
![]() |
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 |