Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Which menu item has been selected?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Which menu item has been selected?

 Post Reply Post Reply
Author
Message
simus View Drop Down
Groupie
Groupie


Joined: 08 July 2005
Status: Offline
Points: 43
Post Options Post Options   Thanks (0) Thanks(0)   Quote simus Quote  Post ReplyReply Direct Link To This Post Topic: Which menu item has been selected?
    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

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
simus View Drop Down
Groupie
Groupie


Joined: 08 July 2005
Status: Offline
Points: 43
Post Options Post Options   Thanks (0) Thanks(0)   Quote simus Quote  Post ReplyReply Direct Link To This Post Posted: 14 December 2005 at 6:36am
Thanks
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.171 seconds.