SLOTUSMENU() Short: ------ SLOTUSMENU() 1-2-3 style menu Returns: -------- <expReturn> => depends on several factors Syntax: ------- SLOTUSMENU(nTop,nLeft,nBottom,nRight,aOptions,[lBox],; [lSaveRest],[lReset]) Description: ------------ Draws a 1-2-3 style menu from <nTop>,<nLeft> to <nTop+1>,<nRight>. <nTop> is the menu option line. <nTop+1> is the message line. <aOptions> is an array of arrays in the format: { {cOption,cMessage,expAction}, {cOption,cMessage,expAction},... } where <cOption> is the option prompt, <cMessage> is the option message, and <expAction> is the option action. <expAction> may be of three types: 1. a codeblock, in which case it is executed on ENTER 2. a submenu array of the form: { {cOption,cMessage,expAction}, ; {cOption,cMessage,expAction},... } which is displayed on ENTER. Pressing ESCAPE from the submenu returns to the prior menu. The submenu <expaction> may be a codeblock, another subarray, or any other value, etc. Thus nesting can go as deep as you like. 3. any other value, which is returned to the calling program on ENTER. Pressing ESCAPE from the main menu returns 0 [lBox] If True, the menu is drawn inside of a popup box. Actual dimensions of the menu area then become <nTop>+1,<nLeft>+1 to <nTop>+2,<nRight>-1. Default is False - no box. [lSaveRest] If True, the underlying screen is saved and restored on entrance/exit. Default is False - no restore. [lReset] If True, the menu is reset to first option on exit. Default is False - menu remembers where it was. SLOTUSCLEAR() resets the menu. Examples: --------- proc test local nReturn := 0 local aMain := {} local aSub1 := {{"Pizza", "Eat Pizza", {||pizza()}},; {"Spaghetti", "Eat Spaghetti", {||spagett()}},; {"Tortellini","Eat Tortellini", {||tortellini()}} } local aSub2 := {{"Steak", "Eat Steak", {||steak()}},; {"Hamburger", "Eat Hamburger", {||burgers()}},; {"Chili Dog", "Eat Chili Dog", {||burntwice()}} } aadd(aMain,{"Italian","Eat Italian food",aSub1}) aadd(aMain,{"American","Eat American food",aSub2}) aadd(aMain,{"Quit","Just not hungry - Quit",0}) aadd(aMain,{"Relief","Already ate - need Alka Seltzer",{||alka()} }) SLOTUSMENU(0,0,0,79,aMain,.t.,.t.,.t.) SLOTUSCLEAR() // !! always use this to clear the menu Notes: ------- Always use SLOTUSCLEAR() after calling SLOTUSMENU() Source: ------- S_LOTMEN.PRG
Pingback: SP Menu Functions | Viva Clipper !
Pingback: SP Functions | Viva Clipper !