* * POPUPEX.KEX * * Sample macro to demonstrate one use of the KEDIT for Windows POPUP command. * * Works with: * * KEDIT for Windows 1.5 * * Create a file called ITEMS.LST that contains one menu item per line of the * file, in the order that you want the items to appear in the menu. Wherever * you want a divider line to appear, leave a blank line. So for example, an * ITEMS.LST file that looked like this: * * * * * Top of File * * * * Carrots * Peppers * * Apples * Oranges * Watermelons * * * * Top of File * * * * * would result in a popup menu like this: * * |-------------| * |Carrots | * |Peppers | * |-------------| * |Apples | * |Oranges | * |Watermelons | * |-------------| * * KEDIT uses it's standard search method when trying to locate ITEMS.LST. * * File that lists menu items - one item per line. You need to create this. SourceFile = "items.lst" "extract /filesearch" SourceFile"/" if filesearch.1 = "NEW" then do "emsg POPUPEX Error 1: Could not locate an" upper(SourceFile) "file" exit 1 end MenuFile = filesearch.2 PopUpCmd = "" * Read in the field list and build a POPUP command do while lines(MenuFile) item = linein(MenuFile) if item = "" then PopUpCmd = PopUpCmd"/-" else PopUpCmd = PopUpCmd"/"item end * Close the file list file call lineout MenuFile if PopUpCmd = "" then do "emsg POPUPEX Error 2: Could not open file" upper(MenuFile) exit 2 end * Let the use know he/she has to do something say "Select a menu item..." * Pop up the list at the current mouse pointer position "popup" PopUpCmd * What was the result? if popup.1 = "" then say "No item was selected..." else say 'You selected item "'popup.1'"'