PULLDN() Short: ------ PULLDN() Pulldown menu creator, handler Returns: -------- <nSelection> => Selection in the form menu.prompt (i.e. 2.04) Syntax: ------- PULLDN(nSelection,aOptions,[aAttributes],[aColumns]) Description: ------------ Draws a pulldown menu with up to 8 separate boxes. Selection process starts with <nSelection>. Each element of <aOptions> defines a menu. A menu definition is a delimited string in the form: "TITLE:prompt:prompt:prompt" with up to 99 prompts per string. When a selection is made, the number of the selection is returned, in the form BOX.OPTION . So option 2 in box 3 would come back as 3.02. [aAttributes] is a box definition array. It is 7 elements long and defines the following: Element: 1. <lDraw> Draw top bar box? T/F 2. <cBarColor> Top bar color 3. <cBoxColor> Menu Box color 4. <cBoxFrame> Menu Box frame 5. <nShadowPos> Menu Box shadow position (0,1,3,7,9) 6. <nShadowAtt> Menu Box shadow attribute 7. <nBarRow> Row to start menu bar [aColumns] is an array of title column positions to override the internal 'figerin algorithm. Examples: --------- aOptions := { "Datafiles:Use Datafile",; "Indices:Select Indices:Index order",; "Editing:Replacement:Tabular Edit",; "Reporting:Build Query:Print Lists",; "Other:List file:Change Directory",; "Quit" } aAttrib := { .t.,; // draw the top bar box 'W/B,GR/R,,,W/N',; // top bar color 'W/B,N/R,,,W/N',; // drop box color cSingle_frame,; // drop box frame 3,; // drop box shadow position 8,; // drop box shadow attribute 0 } // row # of menu bar nSel := 1.01 do while .t. nSel := PULLDN(nSel,aOptions,aAttrib) do case CASE nSel = 0 && TRAP 0 nSel = 1.01 case nSel = 1 case nSel = 2 case nSel = 3 case nSel = 4 endcase enddo Warnings: ---------- It takes some work to start all options and titles with a first letter that is unique so that first letter selection may take place. Notes: ------- First letter selection takes place on the following priority: next matching element first letter, next matching box title first letter. Passing a menu array element with title only will result in no menu box, with the title being the only selection and returning a selection value of <MENU>.1. (i.e. a 'Quit' box) Source: ------- S_PULLDN.PRG
Pingback: SP Menu Functions | Viva Clipper !
Pingback: SP Functions | Viva Clipper !