home *** CD-ROM | disk | FTP | other *** search
/ Stars of Shareware: Programmierung / SOURCE.mdf / programm / windows / basic / winbasic / demo.bas < prev    next >
Encoding:
BASIC Source File  |  1991-10-10  |  3.5 KB  |  187 lines

  1.  
  2. Dim Menu$(5), FontName$(7)
  3.  
  4. Subroutine CheckBackground(n%)
  5.   MenuItem 2001, 1, 0 
  6.   MenuItem 2002, 1, 0 
  7.   MenuItem 2003, 1, 0 
  8.   MenuItem n%, 1, 1
  9. Endsub
  10.  
  11. Subroutine DrawLine()
  12.   x% = 20 : y% = 20 
  13.   MoveTo x%, y%
  14.   For i% = 1 To 8
  15.     Style i%/2, 0, 1
  16.     y% = 220 - y%
  17.     x% = x% + 60
  18.     LineTo x%, y%
  19.   Endfor
  20. EndSub
  21.  
  22. Subroutine DialogBox()
  23.   Dialog 10,20, 150, 80, 0,  0, "Demo Dialog" ' Title
  24.   Dialog 10,10, 50,10,  11, 11, "Button"      ' BUTTON
  25.   Dialog 10,24, 60,10,  13, 13, "OK"          ' DEFBUTTON
  26.   Dialog 10,40, 60,60,  14, 10, "Group"       ' GROUPBOX
  27.   Dialog 14,50, 40,10,  15, 12, "Radio1"      ' RADIOBUTTON
  28.   Dialog 14,64, 40,10,  16, 12, "Radio2"      ' "
  29.   Dialog 14,78, 40,10,  17, 12, "Radio3"      ' "
  30.   Dialog 80,10, 60,10,  18,  5, "LTEXT"       ' LTEXT
  31.   Dialog 80,25, 60,10,  19, 18, "START"       ' LEDIT
  32.   Dialog 80,40, 60,10,  20,  1, "Check"       ' CHECKBOX 
  33.   Dialog
  34.  
  35. _INIT:
  36.   DlgItem 15, 15, 17, 4, "Radio1"
  37.  
  38. _2: 'ESC 
  39.   Dialog @ 
  40.  
  41. _11:
  42.   DlgItem 19, 0, 0, 2, "Button"
  43.  
  44. _13:
  45.   DlgItem 19, String$
  46.   Print String$
  47.   Dialog @
  48.  
  49. _15:
  50.   DlgItem 15, 15, 17, 4, "Radio1"   
  51. _16:
  52.   DlgItem 16, 15, 17, 4, "Radio2"   
  53. _17:
  54.   DlgItem 17, 15, 17, 4, "Radio3"  
  55.  
  56. _20:
  57.   If checked% = 0 Then
  58.     DlgItem 20, 0, 0, 4, "Check"
  59.     checked% = 1
  60.   Else 
  61.     DlgItem 20, 0, 0, 0, "Check"
  62.     checked% = 0
  63.   Endif
  64. Endsub
  65.  
  66.  
  67. Rem  ***  Main program ***
  68.  
  69. FontName$(1) = "Times Roman"
  70. FontName$(2) = "Helvetica"
  71. FontName$(3) = "Swiss"
  72. FontName$(4) = "Script"
  73. FontName$(5) = "Roman"
  74. FontName$(6) = "System"
  75. FontName$(7) = "Courier"
  76.  
  77. Menu$(1) = "&Demo &Info E&xit__F9"
  78. Menu$(2) = "&Background &White &Gray &Black"
  79. Menu$(3) = "&Grafix &Text &Line &Ellipse Ba&r &Pie &Mouse"
  80. Menu$(4) = "&Windows Clock.exe &DialogBox &FileBox &Timer"
  81. Menu$(5) = ""
  82. Menu Menu$
  83. MenuItem 2001, 1, 1
  84.  
  85. Size 10,10, 600,400
  86.  
  87. _MOUSE:
  88.   If mouse% Then
  89.     Mouse button%, x%, y%
  90.     MoveTo x%, y% : Print "Button "; button%
  91.   Endif
  92.  
  93. _KEY:
  94.   If asc%(Inkey$()) = 195 Then Goto _1002
  95.  
  96. _CLOSE:
  97.   If clock% Then Stop "clock.exe"
  98.   clock% = 0
  99.  
  100. _TIMER:
  101.   MessageBox "_TIMER message received", "Alert!", 0, a%
  102.   Timer 10000
  103.  
  104. _1001:
  105.   MessageBox "WinBasic (c) 1991 Zimmer Informatik","Info", 0, a%
  106.  
  107. _1002:
  108.   If clock% Then
  109.     Stop "clock.exe"
  110.     clock% = 0
  111.   Endif
  112.   Stop
  113.  
  114. _2001:
  115.   cls 0 : Gosub CheckBackground(2001)
  116. _2002:
  117.   cls 2 : Gosub CheckBackground(2002)
  118. _2003:
  119.   cls 4 : Gosub CheckBackground(2003)
  120.  
  121. _3001:
  122.   Cls
  123.   Colour 2,-1
  124.   For family% = 1 to 7  
  125.     Font 64,64, 400, 0, family%
  126.     Print FontName$(family%)
  127.   Next
  128.   Font 10,10, 400,0, 6        'Restore system font  
  129.  
  130. _3002:
  131.   cls
  132.   Gosub DrawLine()
  133.  
  134. _3003:
  135.   cls
  136.   Colour 4, 7
  137.   Style 1, 4, 1
  138.   For i% = 150 to 250 step 10
  139.     MoveTo 300,i%
  140.     Ellipse i%,150, 0, 360
  141.   Next
  142.  
  143. _3004:
  144.   cls
  145.   Colour 2, 5
  146.   Style 0, 4, 3 
  147.   MoveTo 300, 150
  148.   Rect 70, 150
  149.  
  150. _3005:
  151.   cls
  152.   Colour 2, 6
  153.   Style 1, 3, 3 
  154.   MoveTo 300, 150
  155.   Pie 100, 0, 270
  156.  
  157. _3006:
  158.   mouse% = 1 - mouse%  '  toggle mouse% between 0/1
  159.   MenuItem 3006, 1, mouse%
  160.  
  161. _4001:
  162.   clock% = 1 - clock%
  163.   If clock% Then
  164.     Cursor 2
  165.     Exec "CLOCK.EXE", "", 7
  166.     Cursor 0
  167.   else
  168.     Stop "CLOCK.EXE"
  169.   Endif
  170.   MenuItem 4001, 1, clock%
  171.  
  172. _4002:
  173.   Gosub DialogBox()
  174.  
  175. _4003:
  176.   Files "\", "*.*", file$
  177.   Print file$
  178.  
  179. _4004:
  180.   timer% = 1 - timer%
  181.   MenuItem 4004, 1, timer%
  182.   if timer% then 
  183.     Timer 10000        ' generate _TIMER message in 10 seconds
  184.   else
  185.     Timer 0        ' turn timer off
  186.   endif
  187.