Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Elaborating a bit about the new MenuBar's functionality

The main change here is about the interpretation of return values.
The original ncurses' return value was a boolean telling us if the menu's loop should be either maintained or ended. A false was "keep going" and a true was "finish the loop".

Making the menu item an item on a list box changes it in two ways:
First: for any Control::driver() method, true means that the message was consumed by the control and false means it was not. In the last case, the parent control try to consume it.
Second: to break the menubar loop you should return a KEY_CANCEL message, since it's break when child::driver(key) == KEY_CANCEL.
A special case is a value of EXIT_APP which is returned to the main menu to indicate the finalization of the app.
The main menu is identified by a flag attribute (is_main_menu), which MUST be set when you construct it on your Application::activateMenuBar reimplementation. Otherwise, the EXIT_APP will be treated as KEY_ESC and the main menu will be closed without asking comfirmation. (see ndk_demo sources for an example)

Posted by Miguel Pinkas 2002-10-13