HTBasic Help
×
Menu
Index

Example: Number Widget

 
10     ! *********************************************************************
20     ! Example: NUMBER Widget
30     !
40     ! This program creates a NUMBER widget. You can enter
50     ! a number from 0 through 1000 from the keyboard. When you
60     ! you press Enter, the number entered is displayed on the
70     ! screen. If you attempt to enter a number greater than
80     ! 1000, an error is generated and the previously-entered
90     ! number is displayed.
100   !
110   ! **********************************************************
120   !
130   ASSIGN @Number TO WIDGET "NUMBER";SET ("REAL NOTATION":"FIXED")
140   CONTROL @Number;SET ("TITLE":" Example: NUMBER Widget")
150   CONTROL @Number;SET ("X":50,"Y":25,"WIDTH":250)
160   CONTROL @Number;SET ("MINIMUM":0,"MAXIMUM":1000)
170   CONTROL @Number;SET ("CHECK FOR DONE":1)
180   CONTROL @Number;SET ("SYSTEM MENU":"Quit")
190   !
200   ON EVENT @Number,"SYSTEM MENU" GOTO Finis
210   ON EVENT @Number,"RETURN" GOSUB Get_number
220   ON EVENT @Number,"DONE" GOSUB Get_number
230   LOOP
240     WAIT FOR EVENT
250   END LOOP
260 Get_number: !
270   STATUS @Number;RETURN ("MODIFIED":New_number,"VALUE":Value)
280   IF New_number THEN
290     DISP "New number: ";Value
300     CONTROL @Number;SET ("MODIFIED":0)
310   END IF
320   RETURN
330   !
340 Finis:   !
350   ASSIGN @Number TO *                                ! Delete NUMBER widget
360   END