HTBasic Help
×
Menu
Index

Example: List Dialog

 
10     ! *********************************************************************
20     ! Example: LIST Dialog
30     !
40     ! This program shows a way to use the MULTISELECT attribute.
50     ! For example, if you click on COSMOPOLITAN, TIME, and SPORTS
60     ! ILLUSTRATED, then click on OK the program displays
70     ! OK 1 0 0 1 0 1 0. The '1's correspond to the selected items.
80     !
90     ! ********************************************************
100   !
110   CLEAR SCREEN
120   INTEGER Btn,Sel(1:7),V(1:2)
130   DIM L$(1:7)[20],P$[40],A$(1:2)[16],S$[16]
140   DATA "COSMOPOLITAN","ENQUIRER","DISCOVER","TIME"
150   DATA "HEALTH","SPORTS ILLUSTRATED","NEW YORKER"
160   READ L$(*)
170      !
180   DATA "MULTISELECT","COLUMNS",1,30, "SELECTION"
190   READ A$(*),V(*),S$
200   P$="Which magazines do you read?"
210   DIALOG "LIST",P$,Btn;SET ("TITLE":" Example: LIST Dialog","ITEMS":L$(*),A$(*):V(*)),RETURN (S$:Sel(*))
220   PRINT " Button      Selection"
230   PRINT
240   IF Btn=0 THEN
250     PRINT USING "8A,3X,7(D,X)";" OK",Sel(*)
260   ELSE
270     PRINT USING "8A,3X,7(D,X)";"Cancel",Sel(*)
280   END IF
290   END