HTBasic Help
×
Menu
Index

Example: Bars Test

 
10     ! *********************************************************************
20     ! Example: BARS Test
30     !
40     ! This program creates a BARS widget with three bars and
50     ! displays the square root (Root) and natural logarithm
60     ! (Ln) of numbers (Number) from 0 to 100.
70     !
80     ! **************************************************
90     !
100   INTEGER M,N
110   REAL Barval(0:2)
120   ASSIGN @Bars TO WIDGET "BARS"
130   CONTROL @Bars;SET ("TITLE":" Example: BARS Test","HEIGHT":300,"WIDTH":300)
140   CONTROL @Bars;SET ("X":50,"Y":25)
150   CONTROL @Bars;SET ("SYSTEM MENU":"Quit")
160   ON EVENT @Bars,"SYSTEM MENU" GOTO Finis
170   !
180   CONTROL @Bars;SET ("BAR COUNT":3)
190   CONTROL @Bars;SET ("CURRENT BAR":1)
200   CONTROL @Bars;SET ("BAR LABEL":"Number")
210   CONTROL @Bars;SET ("CURRENT BAR":2)
220   CONTROL @Bars;SET ("BAR LABEL":"Root")
230   CONTROL @Bars;SET ("CURRENT BAR":3)
240   CONTROL @Bars;SET ("BAR LABEL":"Ln")
250   !
260   FOR M=1 TO 5
270     FOR N=1 TO 100
280       Barval(0)=N
290       Barval(1)=SQR(N)
300       Barval(2)=LOG(N)
310       CONTROL @Bars;SET ("VALUES":Barval(*))
320       WAIT .05
330     NEXT N
340   NEXT M
350 Finis: !
360   ASSIGN @Bars TO *                ! Delete BARS widget
370   END