MENU_DEFINE menu#, "[item 1 name]\1F[item 2 name]\1F[item 3 name]\1F..."
Purpose Define a list of menu item names separated by the \1F character. These menus can then be displayed easily by the MENU_SHOW command
menu# : 1 to 10 - Up to 10 menus can be pre-defined
"...." - : A single string or concatenated strings of menu item names. The ASCII &H1F character separates each item name.
Examples MENU_DEFINE 1, "1. Graphic Demos\1F"+"2. Enter A Number\1F"+"3. Enter Alphanumeric\1F"+"4. Digital I/O Display"
MENU_SHOW 1,2,0,12,1
 Download sample program: WxDemo.PC7

Using MENU_DEFINE and MENU_SHOW commands together creates an extremely simple to deploy, on-screen menu system for user interface. Up to 10 independent menus can be predefined for use. Menus can also be re-defined during runtime if you need more than 10 menus (e.g. for different languages).

Begin by using the MENU_DEFINE command to define the menu (#1 to 10) and a list of item strings to display on the screen. Each item string is separated by the ASCII 'separator' character &H1F (31 decimal). The MENU_SHOW command can then select the menu# to display, the starting coordinates (upper-left corner) to display the menu, and the item# on this menu that has been selected. The item name of the selected item# will then be highlighted in reversed color.

In above example we define MENU#1 with 4 separate item strings concatenated using '\1F' character for clarity (They could also be just one big string comprising all 4 item names joined by '\1F'). The subsequent MENU_SHOW command then select this menu# to display and select item# 2, which causes the second item name to be highlighted.

In actual deployment, the program should use at least two variables (we suggest using the DM[]s) to keep track of the menu# and item# currently in use. When the user changes the item selection or changes to a different menu (e.g. using the keypad or via online monitoring), simply alter the variables that keep track of these data and then run the MENU_SHOW command again to display a new selection or even a new menu completely. The program can then use the menu# and item# to decide what actions to take after the user has made the selection.

For a complete example please download the sample program: WxDemo.PC7


backbutton.gif (507 bytes)  Basic to TBASIC Reference Manual