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 Tech Support » Dynamic menu from ribbon bar? Collapse All
Subject Author Date
Robert Webb Mar 24, 2009 - 12:04 AM

Hi,


I want to have a menu that drops down from the right-button-collection area, but whose contents changes depending on context.


I have already created another similar static menu.  That’s easy enough, by creating a node, adding it to the right button collection, and adding other child nodes which act as menu items.  But how do I get called back when the user clicks on the menu button so that I can fill in the menu before it pops up?  I guess I also need to delete it again after it’s closed.


Thanks,


Rob.

Robert Webb Nov 27, 2009 - 1:05 AM

When using ProfUIS, various things may pop up, such as menus, tooltips, etc.  These may overlap with the main workspace.  Our application uses OpenGL for graphics, and rendering a scene can be quite computationally expensive, so we wish to avoid redraws whenever possible.



Now some things that pop up cause a paint message to be sent, and some do not.  For example, with a ribbon bar, the main application menu may be quite large, but it does not send a paint message for the view area, although it overlaps.  I believe it grabs a bitmap and replaces it afterwards?



Drop-downs from ribbon bar items also avoid sending a paint message.



However, tooltips and old-style menus from a menu bar DO send a paint message.  Tooltips are particularly troublesome, because just pausing the mouse somewhere can cause the main window to redraw.  A tooltip comes up, and when it goes away a paint message is sent.  Tooltips may also appear while browsing through a drop-down menu from the ribbon bar.  A redraw at this point draws over the drop-down, since it overlaps our drawing area, leaving a bit of a mess on the screen, and it seems to almost hang sometimes just when moving the mouse up and down on such a menu, until the mouse is moved off the edge.



Anyway, is there a way to avoid the redraw for tooltips?  Can they be handled the same way as the application menu and other ribbon bar drop-downs?  And same question for old-style menus from the menubar.



On the other hand, sometimes we actually want to redraw while the application menu is open.  For example, we select a recently used file.  It loads and redraws while the menu is still fading out.  However, as the menu fades out it is replaced by the previous contents of the window, after which the view remains drawn incorrectly until next forced to redraw.  So I’m also wondering if you have any advice for this.



Thanks,

Rob.

Robert Webb Nov 27, 2009 - 1:06 AM

Oops sorry, this was meant to go in a new thread, but there’s no way to delete a message in this forum (hint hint).


I’ll post this again as a new topic, please respond there.


Thanks,


Rob.

Technical Support Mar 24, 2009 - 1:17 PM

You don’t need to construct/remove command tree nodes. Please do the following:

http://www.prof-uis.com/prof-uis/tech-support/faq/pop-up-menus.aspx#how-to-insert-menu-items-at-run-time

You should initialize a drop-down button inside the right buttons collection. This button should have only one menu item with predefined command identifier. This menu item is called a "marker item". You should handle the CExtPopupMenuWnd::g_nMsgPrepareMenu registered message as it is described in the F.A.Q. but you should handle it in your CExtRibbonBar-derived class. Each time your handler method is invoked it will deal with the popup menu having only one marker item (it’s ID_MY_REPLACE_CMD in the F.A.Q. referenced above).