Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » How can I update a poped-up menu ? Collapse All
Subject Author Date
Adrian Constantin Nov 26, 2004 - 2:54 AM


Can I have a poped up context menu updated when I change the Enabled state of a command like this

g_CmdManager->CmdGetPtr(AfxGetApp()->m_pszProfileName, ID_CONSOLE_CLOSE)->StateEnable(FALSE)

Please how can I have the poped-up menu imediatly update the correspondig command ? Right now it updates the menu command only after the currently selected menu item is changed.

And I have another question: Can I have the menus functional even before the animation has finished ? I usualy close apps with Alf-F, X in half a second, but with the animation it doesn’t work that fast any more...

I have ProfUIS 2.20 dll (and please don’t tell me to upgrade because my team leader did not agree)

Adrian Constantin

Technical Support Nov 26, 2004 - 11:32 AM

To change the state of any menu item, you need to use a command update handler for the corresponding menu command in your dialog, frame, view or other menu-related window. So, you should not try to access the command manager.

We appreciate your comments on menu animation. If your leader is against any upgrades, then you should attempt to change his/her position because in newer versions old bugs are fixed. Otherwise, we can only recommend you use Alt+F4 instead of Alt+F, X.

Adrian Constantin Nov 29, 2004 - 2:54 AM


Thank you for your response.

My menu-related window is a modal dialog. My problem is how to get the command update handler to be called by Prof-UIS. I mean the pop-up menu is already poped-up (the update handlers have already been called) and while the menu is still open I need to change (or re-update) it.
Right now I ended up setting the state of the command with the command manager, getting the current tracking menu window, if any, and doing InvalidateRect() and UpdateWindow() on it.

Also I am wondering if I can update the CmdU’s of a command in several of my toolbars without enumerating and refreshin all of them

Thank you
Adrian Constantin

Technical Support Nov 30, 2004 - 4:24 AM

Before being displayed, any pop-up menu (either a context menu or a menu initiated from the toolbar/menu bar button) performs both the command updating for the entire menu tree and layout computation for each pop-up sublevel. Until the popup menu is tracked, it does not invoke any command updating handlers. Now let’s imagine that you are able to modify menu items dynamically when the menu is visible. This would lead to unpredictable results. For example, the CCmdUI::SetText() method affects the menu width. If the item, whose text you are updating with CCmdUI::SetText(), had a submenu (that is always displayed at this moment), what code would be responsible for changing the position of this submenu? And there many such things which would cause problems if there was a mechanism for dynamic updating of menu items when the pop-up menu is being tracked. So, you probably need to carefully review the design of your application’s gui to avoid pitfalls we described above.

Adrian Constantin Nov 30, 2004 - 4:49 AM


So that’s how it is ...
Ok then. I take it this is the way things are in the 2.26 version too...

Thank you anyway
Adrian Constantin
Romania