HTBasic Help
×
Menu
Index

Example: String Widget

 
10     ! *********************************************************************
20     ! Example: STRING Widget
30     !
40     ! This program generates a STRING widget and
50     ! allows the user to enter text from the keyboard.
60     ! The text entered by the user is displayed after
70     ! the Enter key is pressed. To exit the program,
80     ! type QUIT and press Enter OR click the PANEL icon
90     ! and then click Quit.
100   !
110   ! ********************************************
120   !
130   CLEAR SCREEN
140   DIM S$[255]
150   ASSIGN @String TO WIDGET "STRING"
160   CONTROL @String;SET ("TITLE":" Example: STRING Widget")
170   CONTROL @String;SET ("X":100,"Y":100,"COLUMNS":30)
180   CONTROL @String;SET ("VALUE":"Enter text here")
190   CONTROL @String;SET ("SYSTEM MENU":"Quit")
200   !
210   ON EVENT @String,"RETURN" GOSUB Handler
220   ON EVENT @String,"SYSTEM MENU" GOTO Finis
230   !
240   LOOP
250     WAIT FOR EVENT
260   END LOOP
270   !
280 Handler: !
290   STATUS @String;RETURN ("VALUE":S$)
300   CONTROL @String;SET ("VALUE":"")
310   IF S$="QUIT" THEN Finis
320   DISP "Text entered:",S$
330   RETURN
340 Finis: !
350   ASSIGN @String TO *                                ! Delete STRING widget
360   END