Print Page | Close Window

Which menu item has been selected?

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=3389
Printed Date: 27 September 2024 at 7:34pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Which menu item has been selected?
Posted By: simus
Subject: Which menu item has been selected?
Date Posted: 12 December 2005 at 2:47am

Hi,

I have a standard CXTPCommandBars. I wanted to handle the "lifetime" of a CXTPCommandBar when it is shown (TrackPopupMenu and MainFrame menu) and the selected item in the command bar if any.

I would like to do this to automatize the autohide of rarely used items in menus.

So I handled :
 ON_XTP_INITCOMMANDSPOPUP()
 ON_XTP_UNINITCOMMANDSPOPUP()
And no problem

Then I handled WM_COMMAND in the MainFrame to catch what command has been selected

The problem I have is that the WM_COMMAND is fired after ON_XTP_UNINITCOMMANDSPOPUP() and I "need" to get it before ON_XTP_UNINITCOMMANDSPOPUP() or at least know before ON_XTP_UNINITCOMMANDSPOPUP() what is the selected item in the menu.
So the question is : Is there an event that occurs between ON_XTP_INITCOMMANDSPOPUP() and ON_XTP_UNINITCOMMANDSPOPUP() that indicates what item has been selected and so what WM_COMMAND will be sent?

Or any other help is welcome.

Thanks a lot

 

So before the CXTPCommandBar is shown I have ON_XTP_INITCOMMANDSPOPUP(), After the




Replies:
Posted By: Oleg
Date Posted: 14 December 2005 at 5:50am

Hi

As workaround in UNINITCOMMANDSPOPUP you can check all controls of PopupBar and check if pControl->GetPressed()

for (....; i < pPopupBar->GetControls()->GetCount()..)

{

   if (pPopupBar->GetControl(i)->GetPressed()) ...
}

 



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: simus
Date Posted: 14 December 2005 at 6:36am
Thanks



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