home *** CD-ROM | disk | FTP | other *** search
/ HTBasic 9.3 / HTBasic 9.3.iso / 83win / data1.cab / Basic_Plus_Examples / TABGROUP < prev    next >
Encoding:
Text File  |  2001-03-02  |  3.3 KB  |  103 lines

  1. 10    ! *****************************************************
  2. 20    ! Example: Tab Groups
  3. 30    !
  4. 40    ! This program creates four tab groups of widgets:
  5. 50    !
  6. 60    !    Group 1: R1_C1, R1_C2, R1_C3
  7. 70    !    Group 2: R2_C1, R2_C2, R2_C3
  8. 80    !    Group 3: R3_C1, R3_C2, R3_C3
  9. 90    !    Group 4: R4_C1, R4_C2, R4_C3
  10. 100   !
  11. 110    ! You can use the Tab key to traverse the four
  12. 120    ! tab groups (from R1_C1 to R2_C1 to R3_C1 to R4_C1).
  13. 130    ! You must use the Arrow keys to traverse within
  14. 140    ! a tab group (e.g., from R1_C1 to R1_C2 to R1_C3, etc.)
  15. 150    !
  16. 160    ! *****************************************************
  17. 170   !
  18. 180       DIM L$[5]
  19. 190       INTEGER D(1:4)
  20. 200       INTEGER Ih,Iw,Pw,Ph,X,Y,Xn,Yn,W,H,Butw,Buth,R,C1,C2,C3
  21. 210   !
  22. 220       GESCAPE CRT,3;D(*)
  23. 230       Pw=(D(3)-D(1))/2
  24. 240       Ph=(D(4)-D(2))/2
  25. 250       X=Pw/2
  26. 260       Y=Ph/2
  27. 270   !
  28. 280       CLEAR SCREEN
  29. 290   !
  30. 300       ASSIGN @Tabgp TO WIDGET "PANEL";SET ("VISIBLE":0)
  31. 310       CONTROL @Tabgp;SET ("TITLE":" Example: Tab Groups")
  32. 320       CONTROL @Tabgp;SET ("X":X,"Y":Y,"WIDTH":Pw,"HEIGHT":Ph)
  33. 330       CONTROL @Tabgp;SET ("MAXIMIZABLE":0,"RESIZABLE":0,"MOVABLE":0)
  34. 340       CONTROL @Tabgp;SET ("SYSTEM MENU":"Quit")
  35. 350       CONTROL @Tabgp;SET ("VISIBLE":1)
  36. 360   !
  37. 370       STATUS @Tabgp;RETURN ("INSIDE WIDTH":Iw,"INSIDE HEIGHT":Ih)
  38. 380   !
  39. 390       Gapw=8               ! column gap size
  40. 400       Gaph=8               ! row gap size
  41. 410       Butw=(Iw-4*Gapw)/3   ! button width
  42. 420       Buth=(Ih-5*Gaph)/4   ! button height
  43. 430       C1=Gaph
  44. 440       C2=C1+Butw+Gapw
  45. 450       C3=C2+Butw+Gapw
  46. 460   !
  47. 470       R=Gaph
  48. 480       L$="R1_C1"
  49. 490       CALL Makebutton(@Tabgp,@B1,L$,C1,R,Butw,Buth,1)
  50. 500   !
  51. 510       L$="R1_C2"
  52. 520       CALL Makebutton(@Tabgp,@B2,L$,C2,R,Butw,Buth,0)
  53. 530   !
  54. 540       L$="R1_C3"
  55. 550       CALL Makebutton(@Tabgp,@B3,L$,C3,R,Butw,Buth,0)
  56. 560   !
  57. 570       R=R+Buth+Gaph
  58. 580       L$="R2_C1"
  59. 590       CALL Makebutton(@Tabgp,@B4,L$,C1,R,Butw,Buth,1)
  60. 600   !
  61. 610       L$="R2_C2"
  62. 620       CALL Makebutton(@Tabgp,@B5,L$,C2,R,Butw,Buth,0)
  63. 630   !
  64. 640       L$="R2_C3"
  65. 650       CALL Makebutton(@Tabgp,@B6,L$,C3,R,Butw,Buth,0)
  66. 660   !
  67. 670       R=R+Buth+Gaph
  68. 680       L$="R3_C1"
  69. 690       CALL Makebutton(@Tabgp,@B7,L$,C1,R,Butw,Buth,1)
  70. 700   !
  71. 710       L$="R3_C2"
  72. 720       CALL Makebutton(@Tabgp,@B8,L$,C2,R,Butw,Buth,0)
  73. 730   !
  74. 740       L$="R3_C3"
  75. 750       CALL Makebutton(@Tabgp,@B9,L$,C3,R,Butw,Buth,0)
  76. 760   !
  77. 770       R=R+Buth+Gaph
  78. 780       L$="R4_C1"
  79. 790       CALL Makebutton(@Tabgp,@B10,L$,C1,R,Butw,Buth,1)
  80. 800   !
  81. 810       L$="R4_C2"
  82. 820       CALL Makebutton(@Tabgp,@B11,L$,C2,R,Butw,Buth,0)
  83. 830   !
  84. 840       L$="R4_C3"
  85. 850       CALL Makebutton(@Tabgp,@B12,L$,C3,R,Butw,Buth,0)
  86. 860   !
  87. 870       ON EVENT @Tabgp,"SYSTEM MENU" GOTO Finis
  88. 880   !
  89. 890       LOOP
  90. 900           WAIT FOR EVENT
  91. 910       END LOOP
  92. 920   !
  93. 930  Finis:!
  94. 940       ASSIGN @Tabgp TO *! Delete PANEL widget
  95. 950       END
  96. 960   !
  97. 970       SUB Makebutton(@Tabgp,@B,L$,INTEGER X,Y,W,H,Ts)
  98. 980           ASSIGN @B TO WIDGET "PUSHBUTTON";PARENT @Tabgp,SET ("VISIBLE":0)
  99. 990           CONTROL @B;SET ("X":X,"Y":Y,"WIDTH":W,"HEIGHT":H)
  100. 1000           CONTROL @B;SET ("LABEL":L$)
  101. 1010           CONTROL @B;SET ("TAB STOP":Ts,"VISIBLE":1)
  102. 1020       SUBEND
  103.