Syntax:
If: n=#-of-elements in box, w=width of lines in box
Then: dim name[n](w) as in dim name[4](12)
If:
Then: name["1"]="Line 1 of box" ; name["2"]="Line 2 of box"
Then: name["3"]="Line 3 of box"; ... ; name[n]="Line n of box"
Then: a=LISTBOX(name,first,last,row,col,height,width)
Then: aa=LISTBOX(array,first,last,row,col,height,width [,position])
Version Ref: 4.1
5.0 (Enhanced)
Description:
Displays a popup window containing a list of values from "name", an array defined with DIM.
Only "name" is required, all other parameters are optional. "first" and "last" refer to the range within the array to use (defaults to first and last elements of the array).
All parameters up to the last parameter used must be specified. Any unused parameters may be specified as a NULL string (" ''). Examples of valid parameter lists follow:
Then: aa=LISTBOX(array,"","","","",height,width)
Then: aa=LISTBOX(array,"","","","","",width)
Then: aa=LISTBOX(array,"","","","",height,"")
Unused trailing parameters can be omitted. For example, the following two statements are equivalent:
Then: aa=LISTBOX(array,"","",row,col)
Then: aa=LISTBOX(array,"","",row,col,"","")
Note Version 5.0 enhanced "LISTBOX" to take an optional 8th parameter, which is the position of the initial highlight.
If row/col/height/width are not given, the window is centered on the screen. If the window is larger than needed, it will be shrunk accordingly.
The user sees the listbox (as prescribed) on the screen and control is handed to the user. Moving the highlighted bar to the desired choice and pressing ENTER deposits the number of the listbox item in the specified variable to the left of the equal sign, and puts control back on the processing table. The listbox will be cleared automatically from the screen. Appropriate action can be taken based on the number chosen by the user.
Choices from the listbox are made by positioning the highlight bar to the desired element with the arrow keys, or by pressing the first character of that element, then pressing < RETURN >. If the desired element is named "test!," pressing "t" selects it. Select the next element (named "test2") by pressing "t" again.
The < PgUp > and < PgDn > keys may be used to move between screen pages. Use < HOME > to move the highlight to the first element on each screen page.
Description:
Prompts the user to select a value from a list.
Examples:
Then: dim months[l2](3)
Then: months["1"]="Jan";months["2"]="Feb";...months["12"]="Dec"
Then: a=LISTBOX(months,"","","","","3")
Then: show "You chose month#"<a<"which is"<months[a]
@keyH If:
Then: dim hbox[3](41)
Then: hbox["1"]="1) Print the full schedule for this date."
Then: hbox["2"]="2) Print the schedule for a specific Dr."
Then: hbox["3"]="3) Cancel hardcopy request. "
Then: sg=listbox(hbox)
If: @sk="SAVE"
Then: goto @keyH
If: @sk="BRKY"
Then: end
If: sg="1"
Then: goto doform1
If: sg="2"
Then: goto doform2
If: sg="3"
Then: end
doform1 If: '*doform1
Then: beep
Then: msgbox "\n\rThis schedule is\r\n\rnow printing. \r\n\n"
Then: sn="rreport pcdappdet -f alldoctors -v vall -id -a -u -bg -bs 2>/d
ev/null 1>/dev/null -r"<p&d
If: 'the /dev/null redirections to /dev/null are for Unix only
Then: system noredraw sn
Then: end
doform2 If: '*doform2
Then: input popup sl "Enter Doctor \r1-8\r\n==> "
If: sl=""
Then: end
If: sl lt "1" or sl gt "8"
Then: goto doform2
Then: sm=doctnum[sl]
Then: sn="rreport pcdappdet -f singlecoct -v vsingle -ia -a -u -bg -bs 2
>/dev/null 1>/dev/null -r"<sm&p&d
If: ' the /dev/null redirections above are for Unix only
Then: beep
Then: msgbox "\n\r This schedule is\r\n\rnow printing. \r\n\n"
Then: system noredraw sn
Then: end
NOTE: LISTBOX usage can be very elaborate. Large multiple page arrays may be put up which start and end at varying places in the array based on other processing. Also, the elements of the listbox can be filled with varying text each time they are displayed by reloading the array elements before putting the LISTBOX up on the screen (lines 260-261 below). If any of the options such as beginning element and ending element are not needed, use a "" as a placeholder in their stead (line 266 below).
Then: 'following arrays used on doctor by hour listbox
Then: dim lbox[90](74)
Then: dim num1[90](10) ; dim num2[90](10) ; dim num3[90](10)
Then: dim name1[90](20) ; dim name2[90](20) ; dim name3[90](20)
Then: dim tim[90](6,,g)
Then: tim["1"]=" 7:00a" ; tim["2"]=" 7:10a" ; tim["3"]=
" 7:20a" ; tim["4"]=" 7:30a" ; tim["5"]=" 7:40a" ; tim["6"]
" 7:50a"
Then: tim["7"]=" 8:00a" ; tim["8"]=" 8:10a" ; tim["9"]=
" 8:20a" ; tim["10"]=" 8:30a" ; tim["11"]=" 8:40a" ; tim["12"]=
" 8:50a"
...
...
Then: tim["85"]=" 9:00p" ; tim["86"]=" 9:10p" ; tim["87"]=
" 9:20p" ; tim["88"]=" 9:30p" ; tim["89"]=" 9:40p" ; tim["90"]=
" 9:50p"
dosked If: '*dosked
Then: gosub ldnum ; gosub ldnames ; i(2,.0)="1"
loop If: i le "90"
Then: lbox[i]=tim[i]&" "&num1[i]&" "&""name1[i] ; i=i+"1";goto loop
Then: display "doctday"
Then: show ("1","1") " Schedule for: Dr. " & doctlongname[a] < "on" < "\
r" & jk & "\r" < jm < ra
Then: show ("22","1") "Use \r ARROWS \r or \r Nxt-Page \r, \r Prv-Page \r
keys. Press \r RETURN \r to select time slot."
Then: show ("24","2") "(You must choose 'beginning' time slot of existing
appts to view/modify them.)"
If: 'z will hold the number of the element selected, remember the offset
Then: z=listbox(lbox,b,e,"4","1","18","")
If: @sk="BRKY"
Then: cls ; return
If: @sk="SAVE"
Then: cls ; return
If: 'deals with the offset for morning, afternoon, evening
Then: z=z+(b-"1")
Then: gosub filpats