Home » U++ Library support » Menus&Toolbars » Minor crash with Menu... [FIXED]
Minor crash with Menu... [FIXED] [message #2246] |
Wed, 05 April 2006 10:32 |
gprentice
Messages: 260 Registered: November 2005 Location: New Zealand
|
Experienced Member |
|
|
Hi
I've encountered a minor crash situation. In the menu reference example, I changed the code as shown below so that when the menu was clicked, there were no items added to the popup menu. With or without the PromptOK line, clicking on "Menu" then pressing down arrow crashes the app.
void Menu(Bar& bar)
{
PromptOK(AsString(234));
/********
bar.Add("Enable numbers", THISBACK(EnableNumbers))
.Check(numbers_enabled);
bar.Add(numbers_enabled, "Numbers", THISBACK(SubMenu));
bar.Add("Exit", THISBACK(Exit))
.Key(K_CTRL_E);
**********/
}
I was trying to understand how the menus work and why a sub-menu appears when the Numbers item is clicked - i.e. when the callback to SubMenu occurs, the "calling" code has no idea whether the callback function is going to populate a submenu or not - so the "bar" passed to SubMenu must be a different bar than the one passed to Menu, otherwise the bar.Add in submenu would add on to the original menu instead of creating a new sub-menu.
It seems like every menu callback function has a "bar" passed to it in case it wants to create a sub-menu - is there any other reason for passing bar in the callback?
Anyways, no need for long explanation. It's just a subtlety I'm trying to get my head round.
Graeme
[Updated on: Wed, 03 May 2006 20:10] by Moderator Report message to a moderator
|
|
|
Goto Forum:
Current Time: Fri Mar 29 06:26:25 CET 2024
Total time taken to generate the page: 0.01819 seconds
|