|MENU_SHOW menu#, selectedItem#, xPosition, yPosition, textSize|
|Purpose||Display the menu# defined by the MENU_DEFINE command and highlight the item name corresponding to the selectedItem#|
Note: The origin is at the upper-left hand corner of the screen. Default screen resolution is 128x64
|Examples||MENU_DEFINE 1, "1. Graphic Demos\1F"+"2. Enter A Number\1F"+"3. Enter Alphanumeric\1F"+"4. Digital I/O Display"
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 DMs) 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.
Basic to TBASIC Reference Manual