Liberty BASIC Help Online

POPUPMENU
 
POPUPMENU "text", [branchLabel], "text2", [branchLabel2],  |  , . . .
 
Description:
This command pops up a Windows menu.  The upper left corner of the menu will be positioned where the cursor is located when the command is issued.  Each "text", [branchLabel] pair after the title adds a menu item to the menu, and tells Liberty BASIC where to branch to when the menu item is chosen.  The " | " character can optionally be placed between menu items to cause a separating line to be added between the items when the menu is popped up. 
 
The " & " character placed in the text items for the menu specifies the accelerator placement for each item.  The letter directly following the " & " character will act as a hotkey for that menu item, when it is pressed while the user presses and holds down the ALT key. The hotkey appears underlined in the menu display.
The menu command is written on a single line.  It may be displayed in multiple lines for viewing if the continuation character ( _ ) is used.
 
Here is an example of a graphics window with a popupmenu:
 
  nomainwin
  open "Geometric White-board" for graphics_nsb as #geo
  print #geo, "trapclose [quit]"
  print #geo, "when rightButtonUp [popupMenu]"
  wait  ' stop and wait for a menu item to be chosen
 
[popupMenu]
  popupmenu "&Square Spiral", [asSquare], _
            "&Triangular Spiral", [asTriangle]
  wait
 
[asSquare]
  print #geo, "cls ; home ; down ; color red"
  for x = 1 to 120
    print #geo, "go "; x; " ; turn 87"
  next x
  wait
 
[asTriangle]
  print #geo, "cls ; home ; down ; color blue"
  for x = 1 to 120
    print #geo, "go "; x; " ; turn 117"
  next x
  wait
 
[quit]
  close #geo
  end
 
Notice that the & character placed in the title and text items for the menu determines the accelerator placement for each menu item.
 
   See also MENU


Copyright (C) 2003 Shoptalk Systems
Liberty BASIC - http://www.libertybasic.com/