HTBasic Help
×
Menu
Index

Example: Engine Monitor - Level -0 Widgets

 
10     ! *********************************************************************
20     ! Example: Engine Monitor - Level-0 Widgets
30     !
40     ! This program displays a simulated engine monitor for
50     ! a theoretical engine. Torque, pressure, and dwell are
60     ! displayed, as well as a Status Log.
70     !
80     ! ********************************************************
90     !
100   DIM Buf$[200]
110   !
120   ! Create the widgets
130   !
140   ASSIGN @Meter1 TO WIDGET "METER";SET ("X":200,"Y":10,"WIDTH":150,"HEIGHT":175,"TITLE":"Torque","ARC WIDTH":3)
150   ASSIGN @Bars1 TO WIDGET "BARS";SET ("X":375,"Y":10,"WIDTH":150,"HEIGHT":250,"TITLE":"Pressure","SHOW LIMITS":0)
160   ASSIGN @Dispdwell TO WIDGET "LABEL";SET ("X":200,"Y":200,"WIDTH":150,"HEIGHT":60,"TITLE":"Dwell")
170   ASSIGN @Logtext TO WIDGET "PRINTER";SET ("X":200,"Y":275,"WIDTH":325,"HEIGHT":100,"TITLE":"Status Log")
180   ASSIGN @Label TO WIDGET "LABEL"
190   CONTROL @Label;SET ("X":10,"Y":10,"WIDTH":150,"HEIGHT":25,"TITLE":" Quit ","SYSTEM MENU":"Quit")
200   ON EVENT @Label,"SYSTEM MENU" GOTO Finis
210   !
220   !  Run the widgets for the engine monitor
230   !
240   Value=50
250   Siz=15
260 Loop_val: !
270   FOR I=1 TO 10000
280      !
290     IF Value<25 OR Value>=85 THEN Value=50
300     Torq=INT(Value+Siz*RND)
310     Pres=INT(Value+Siz*RND)
320     Dwell=INT(Value+Siz*RND)
330     Value=INT(Value+Siz*(RND-.5))
340      !
350     CONTROL @Meter1;SET ("VALUE":Torq)
360     CONTROL @Bars1;SET ("VALUE":Pres)
370     CONTROL @Dispdwell;SET ("VALUE":Dwell)
380     OUTPUT Buf$ USING "#,K,DDDD,X,DDD,DDD,DDD";"Update #";I,Torq,Pres,Dwell
390     CONTROL @Logtext;SET ("APPEND TEXT":Buf$)
400   NEXT I
410   GOTO Loop_val
420   !
430   STOP
440 Finis: END