Menubar
The top level menu bar appears underneath the application's title bar. The MenuBar creates MenuPopUps when the user selects a top-level item which has a MENU_POPUP style.
The application does not fill in these window structures nor create the windows, but it does allocate storage space for them (indirectly) when it allocates the LHAPIBLOCK structure. The LHAPI system initializes them when a <MENU> key or <ALT> key press is intercepted. Their content is based on the menu pointer in the window structure which has the focus.
Window Structure Details
- PLHCLASS Class: If Class = NULL, LHAPI fills in the Menubar. If Class is non-NULL, the Menubar Class field remains untouched by LHAPI. This allows an application to provide subclasses of menus or popup menu.
- int x,y,w,h: MenuBar handler automatically sets these values on a CREATE message.
- PLHRES Title: Not used.
- PLHDATA Data: Data points to the menu definition, which is an array of LHMENU structures. Each structure defines one menu item and consists of title, handler, hotkey, and style (see lhapi.h for actual details of the field meanings).
- UINT LogicalSize: Set during a CREATE message.
- UINT Style: Set during a CREATE message.
- PLHWINDOW Parent: Used by the Object class handler.
- PLHFKEYS FKeys: Used by the Object class handler.
- PLHMENU Menu: Not used.
- UINT Selection: Selection defines the currently selected item within the menu.
- UINT WindowTop: Not used.
Messages
- KEYSTROKE: The following keys are recognized:
- DownArrow or Enter activates the currently selected menu item. If it is another menu (the Style field for that item's menu structure has MENU_POPUP set), MenuBar creates a pull-down menu, otherwise MenuBar dispatches the routine pointed to by Handler field. The dispatch may consist of a direct function call, a message send, or an automatic window creation (see MENU_SENDMSG and MENU_CREATEWND in lhapi.h).
- LeftArrow or RightArrow moves the cursor to the next/prior top menubar item.
- Letter or Alt+Letter moves the cursor to the menu item with the corresponding underscored letter (mnemonic) and "does" that item (pulls down a submenu or executes the menu action).
- ESC destroys the MenuBar.
- MenuBar ignores the Menu key.
- DRAW: The MenuBar handler draws the MenuBar with a shadow underneath and to the right. For details on the Styles interpreted by the MenuBar, see LHAPI.H.
- CREATE: MenuBar sets x,y,w,and h to appear underneath the application's title bar, across the entire width of the screen. MenuBar sets the STYLE_SAVEUNDER bit in the Style field, and sets the Menu field to NULL.
- SETFOCUS: Passed to the Object class handler.
- LOSEFOCUS: Passed to the Object class handler.
- NULLEVENT: Passed to the Object class handler.
- DESTROY: Passed to the Object class handler.
- TERMINATE: Passed to the Object class handler.
- ACTIVATE: Passed to the Object class handler.
- DEACTIVATE: Passed to the Object class handler.
- NOTIFY: Passed to the Object class handler.
- COMMAND: Passed to the Object class handler.
- APPEAR: Passed to the Object class handler.
- DISAPPEAR: Passed to the Object class handler.