11-18-2014 11:44 AM - edited 11-18-2014 11:45 AM
I have a situation where I would like to change only one menu in a menubar depending on certain conditions. I realize there's the EmptyMenu and NewMenu functions, but then I have to go and rebuild the entire menu each time. These two menus I have built in my UIR, complete with icons, coloring, separators, callback functions, etc. Fairly complicated to duplicate entirely in code.
The two look like this:
What's not shown above is that there are other adjacent menus in this menubar. So I can't just remove the entire menubar.
Is there a simpler way of replacing the menus within a menu bar with a different menu from a UIR?
11-18-2014 01:27 PM
I never tried myself but you possibly could
Not very convenient but maybe better than your approach...
I thought having suggested some improved menu editor but couldn't find it... so maybe you go ahead...
11-19-2014 01:47 AM - edited 11-19-2014 01:54 AM
It's not clear to me whether you want to do this at design time or runt time. If at design time then you may follow the good suggestion from Wolfgang.
If at runtime, you could go a slightly different way: design a menu with all the functions you need to use in any condition, then install a menu dimmer callback to dim the items you cannot/must not use in the particular operating condition you are when the menu is shown. See this community thread for reference. I am using this way extensively and it's a very fast and robust concept schema.
11-19-2014 12:14 PM
Roberto, I was referring to a run-time solution. And your dimming concept I am using now. It works nicely. But what I'm after is a slightly more efficient way of handling menus for the user.
I like your reminder that I could simply make a single big menu which is a union of both menus that will show independently under the right conditions. However, in my case, I would want to completely hide (for less visual clutter) the menu items that don't relate contextually. I don't see that as an attribute type for menus, just dimming. The closest seems to be DiscardMenuItem, but this removes it from memory.
11-20-2014 02:54 PM
I opted for the easier way out and used two separate menus with dimming. I'm with you, Roberto.