HTBasic Help
×
Menu
Index

Tab Groups Example

 
10     ! *****************************************************
20     ! Example: Tab Groups
30     !
40     ! This program creates four tab groups of widgets:
50     !
60     !    Group 1: R1_C1, R1_C2, R1_C3
70     !    Group 2: R2_C1, R2_C2, R2_C3
80     !    Group 3: R3_C1, R3_C2, R3_C3
90     !    Group 4: R4_C1, R4_C2, R4_C3
100   !
110   ! You can use the Tab key to traverse the four
120   ! tab groups (from R1_C1 to R2_C1 to R3_C1 to R4_C1).
130   ! You must use the Arrow keys to traverse within
140   ! a tab group (e.g., from R1_C1 to R1_C2 to R1_C3, etc.)
150   !
160   ! *****************************************************
170   !
180   DIM L$[5]
190   INTEGER D(1:4)
200   INTEGER Ih,Iw,Pw,Ph,X,Y,Xn,Yn,W,H,Butw,Buth,R,C1,C2,C3
210   !
220   GESCAPE CRT,3;D(*)
230   Pw=(D(3)-D(1))/2
240   Ph=(D(4)-D(2))/2
250   X=Pw/2
260   Y=Ph/2
270   !
280   CLEAR SCREEN
290   !
300   ASSIGN @Tabgp TO WIDGET "PANEL";SET ("VISIBLE":0)
310   CONTROL @Tabgp;SET ("TITLE":" Example: Tab Groups")
320   CONTROL @Tabgp;SET ("X":X,"Y":Y,"WIDTH":Pw,"HEIGHT":Ph)
330   CONTROL @Tabgp;SET ("MAXIMIZABLE":0,"RESIZABLE":0,"MOVABLE":0)
340   CONTROL @Tabgp;SET ("SYSTEM MENU":"Quit")
350   CONTROL @Tabgp;SET ("VISIBLE":1)
360   !
370   STATUS @Tabgp;RETURN ("INSIDE WIDTH":Iw,"INSIDE HEIGHT":Ih)
380   !
390   Gapw=8                                                ! column gap size
400   Gaph=8                                                ! row gap size
410   Butw=(Iw-4*Gapw)/3                ! button width
420   Buth=(Ih-5*Gaph)/4                ! button height
430   C1=Gaph
440   C2=C1+Butw+Gapw
450   C3=C2+Butw+Gapw
460   !
470   R=Gaph
480   L$="R1_C1"
490   CALL Makebutton(@Tabgp,@B1,L$,C1,R,Butw,Buth,1)
500   !
510   L$="R1_C2"
520   CALL Makebutton(@Tabgp,@B2,L$,C2,R,Butw,Buth,0)
530   !
540   L$="R1_C3"
550   CALL Makebutton(@Tabgp,@B3,L$,C3,R,Butw,Buth,0)
560   !
570   R=R+Buth+Gaph
580   L$="R2_C1"
590   CALL Makebutton(@Tabgp,@B4,L$,C1,R,Butw,Buth,1)
600   !
610   L$="R2_C2"
620   CALL Makebutton(@Tabgp,@B5,L$,C2,R,Butw,Buth,0)
630   !
640   L$="R2_C3"
650   CALL Makebutton(@Tabgp,@B6,L$,C3,R,Butw,Buth,0)
660   !
670   R=R+Buth+Gaph
680   L$="R3_C1"
690   CALL Makebutton(@Tabgp,@B7,L$,C1,R,Butw,Buth,1)
700   !
710   L$="R3_C2"
720   CALL Makebutton(@Tabgp,@B8,L$,C2,R,Butw,Buth,0)
730   !
740   L$="R3_C3"
750   CALL Makebutton(@Tabgp,@B9,L$,C3,R,Butw,Buth,0)
760   !
770   R=R+Buth+Gaph
780   L$="R4_C1"
790   CALL Makebutton(@Tabgp,@B10,L$,C1,R,Butw,Buth,1)
800   !
810   L$="R4_C2"
820   CALL Makebutton(@Tabgp,@B11,L$,C2,R,Butw,Buth,0)
830   !
840   L$="R4_C3"
850   CALL Makebutton(@Tabgp,@B12,L$,C3,R,Butw,Buth,0)
860   !
870   ON EVENT @Tabgp,"SYSTEM MENU" GOTO Finis
880   !
890   LOOP
900     WAIT FOR EVENT
910   END LOOP
920   !
930 Finis:   !
940   ASSIGN @Tabgp TO *                                ! Delete PANEL widget
950   END
960   !
970   SUB Makebutton(@Tabgp,@B,L$,INTEGER X,Y,W,H,Ts)
980     ASSIGN @B TO WIDGET "PUSHBUTTON";PARENT @Tabgp,SET ("VISIBLE":0)
990     CONTROL @B;SET ("X":X,"Y":Y,"WIDTH":W,"HEIGHT":H)
1000    CONTROL @B;SET ("LABEL":L$)
1010    CONTROL @B;SET ("TAB STOP":Ts,"VISIBLE":1)
1020  SUBEND