Creating a menu bar with Pull-Down menus is a little bit more complicated than creating a Simple popup menu. The main reason is that this type of menu contains several maps: if the menu bar is map n and there are m options on the bar, then maps n+1 though n+m are used for the pull downs.
You should use mapedit to create this type of menu. In release 4.6xx MAPEDIT has a special editor for editing menus. You should find this fairly easy to use, and it is not described here. Unfortunately it does not allow you to create secondary pull downs (pull downs on pull down), though these are supported.
To set up a menu bar menu with pull-down menus using 4.5xx, use MAPEDIT to create a map with the options on a horizontal line. Use the Pull-Down option to attach pull-down menu maps to each option. Set the map properties for each pull down as a popup menu with as many rows as there are options, and 1 column.
You can set up mnemonics and function keys for the action-bar options, or for the options on any of the pull-down menus.
An important difference from map_choose() is that with map_bar_choose() you must display the menu bar before calling map_bar_choose. The rational for this is that the menu bar is normally left on the screen permanently, so it is inappropriate for map_bar_choose() to draw and then clear it.
Here is a typical call to map_bar_choose() and part of the following switch statement (taken from the code for QABUTIL)
map_draw(230,MENUMAP|RETAIN);
if (map_bar_choose(230,&action,HAS_PULL_DOWN,0,banned_list))
action = 0x1f;
switch (action)
{
case 0x11:
case 0x12:
case 0x13:
case 0x14:
case 0x15:
case 0x16:
case 0x17:
case 0x18:
case 0x19:
export(action & 0xf,0);
loadmainmap();
break;
case 0x1a:
do_qabpost();
loadmainmap();
break;
case 0x1b:
transfer_options();
break;
|
Pull-down menu options are represented by the value:
16*X + Y
Where:
X = Number of Action-Bar Field
Y = Number of Pull-Down Menu Option
It is convenenient to use hexadecimal when working with pull-down options, for example the value 0x41 represents option 1 from the pull-down menu for action-bar field 4.
You can grey-out options with an array as with map_g_choose, for example:
banned[0] = 1;
banned[1] = 0x31;
banned[2] = 0;