For those interested in a different type of list, the following code displays an array of items in an EF located in what would normally be the gray area of a horizontal scroll bar (button type 18, sys 7.5.5):
COMPILE 0, _caseInsensitive
DIM List$(11)
DIM selection%
END GLOBALS
LOCAL FN arrowList
List$(1)="Alabama"
List$(2)="Alaska"
List$(3)="Connecticut"
List$(4)="Delaware"
List$(5)="Indiana"
List$(6)="Iowa"
List$(7)="Michigan"
List$(8)="Mississippi"
List$(9)="Oregon"
List$(10)="Rhode Island"
List$(11)="Wyoming"
END FN
LOCAL FN setBtn(btnID,min,max,initial)
arrowValue& = BUTTON&(btnID) 'Button handle
LONG IF arrowValue&
CALL SETCTLMIN(arrowValue&,min) 'Lower limit
CALL SETCTLMAX(arrowValue&,max) 'Upper limit
CALL SETCTLVALUE(arrowValue&,initial) 'Initial value
END IF
EDIT$(2)=List$(FN GETCTLVALUE(arrowValue&)) 'Initial List Item
END FN
LOCAL FN buildWnd
WINDOW OFF
WINDOW#1,"arrowBtnList.demo",(0,0)-(300,180),_docNoGrow
FN arrowList 'Fill array with List Items
EDIT FIELD#1,"Select Home of STAZ Software",(60,35)-(250,50),_statNoFramed,_centerJust
EDIT FIELD#2,,(102,92)-(208,104),_noFramed,_centerJust 'EF in center of arrow
BUTTON#1,_activeBtn,,(85,90)-(225,106),18 'Type 18 = arrowBtn (no Thumb)
FN setBtn(1,1,11,1) 'Set values of Btn
EDIT FIELD(0) 'Deactivate EF so _efClick will work
END FN
LOCAL FN doDialog
DIM bullet$
bullet$=CHR$(165)
evnt = DIALOG(0)
id = DIALOG(evnt)
SELECT CASE evnt
CASE _efClick
selection% = FN GETCTLVALUE(BUTTON&(1)) 'Get selection
LONG IF LEFT$(EDIT$(2),1)=bullet$
tmp$ =EDIT$(2) 'don't add extra bullets for double click, already there.
XELSE
tmp$ = bullet$ + " " + EDIT$(2) + " " +bullet$ 'Get text and add bullets
END IF
COLOR _zRed 'Make text red
EDIT$(2) = tmp$ 'Put it back in EF
COLOR _zBlack 'Reset text to black
LONG IF selection% = 8
CLS:PRINT%(110,70)"That's correct!!"
XELSE
CLS:PRINT%(85,70)"Make another selection."
END IF
EDIT FIELD(0)
CASE _btnClick
SELECT id
arrowValue& = BUTTON&(id)
LONG IF arrowValue&
LONG IF FN GETCTLVALUE(arrowValue&) = selection% 'If it was selected
COLOR _zRed 'Keep it red
tmp$ = CHR$(165) + " " + List$(FN GETCTLVALUE(arrowValue&)) + " " + CHR$(165)
EDIT$(2) = tmp$
XELSE
COLOR _zBlack
EDIT$(2) = List$(FN GETCTLVALUE(arrowValue&))
END IF
END IF
EDIT FIELD(0)
END SELECT
CASE _wndClose
END
END SELECT
END FN
FN buildWnd
ON DIALOG FN doDialog
DO
HANDLEEVENTS
UNTIL 0