home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 14 / CDACTUAL.iso / cdactual / demobin / share / program / Basic / QWINDO.ZIP / WOPEN.BAS < prev   
Encoding:
BASIC Source File  |  1990-01-01  |  2.2 KB  |  56 lines

  1. '****************************************************************************
  2. ' WOPEN.BAS - Demo of how to open a window.
  3. '****************************************************************************
  4. REM $DYNAMIC
  5. DEFINT A-Z              'Make all variables integers by default.
  6. CALL QWINIT(4)          'Need to call this command before using any QW commands.
  7. CLS                     'Clear the screen.
  8. ' --------------------------------------------------------------------------
  9. 'Dimension integer arrays to hold screen contents under window.
  10. '        Size of array = (x2%-x1%+1) * (y2%-y1%+1)
  11. DIM SHARED ary1(700), ary2(800), ary3(700)
  12.  
  13. ' Open our first window.
  14. w1 = 1                  'Setup window id variables. Each should be unique.
  15. ax1 = 1                 'Left side of window (Column).
  16. ax2 = 38                'Right side.
  17. ay1 = 3                 'Top of window (Row).
  18. ay2 = 18                'Bottom.
  19. astyle = 2              'Style = 2 = Double line border.
  20. acolor = &H40           'Color = black(0) on red(4).
  21. atitle$ = "WINDOW ONE"  'Window's title, null ("") if no title desired.
  22. CALL WOPEN(ax1, ay1, ax2, ay2, astyle, acolor, atitle$, ary1(), w1)
  23. CALL WSETCSR(w1, 2, 12) 'Set Cursor Shape (Optional)
  24. CALL WCSRON(w1)         'Turn on cursor. (Optional here)
  25. CALL WCOLOR(w1, &H17)   'Set new color for printing.
  26.  
  27. ' Do it again for second window.
  28. w2 = 2
  29. bx1 = 40: bx2 = 77: by1 = 3: by2 = 22: bstyle = 5
  30. bcolor = &HA: btitle$ = "WINDOW TWO"
  31. CALL WOPEN(bx1, by1, bx2, by2, bstyle, bcolor, btitle$, ary2(), w2)
  32. CALL WCOLOR(w2, 14)
  33. ' ---- & Fill both windows with strings ---
  34. FOR i = 1 TO 500 STEP 2
  35.   CALL WPRINT(w1, STR$(i))
  36.   CALL WPRINT(w2, STR$(i + 1))
  37. NEXT i
  38.  
  39. ' Now open a THIRD window. This time we'll specify parameters directly
  40. ' in the call itself instead of using variables.
  41. w3 = 3
  42. CALL WOPEN(20, 6, 60, 15, 1, &H5, "WINDOW THREE", ary3(), w3)
  43. FOR i = 1 TO 500
  44.    CALL WLOCATE(w3, 16, 4)
  45.    CALL WPRINT(w3, MID$(STR$(i), 2))
  46. NEXT i
  47.  
  48. '---  Now wait for user to press key, then close windows 1 at a time. ---
  49. LOCATE 1, 1: LINE INPUT "Press ENTER: "; a$
  50. CALL WCLOSE(w3)
  51. LOCATE 1, 1: LINE INPUT "Press ENTER again: "; a$
  52. CALL WCLOSE(w2)
  53. LOCATE 1, 1: LINE INPUT "Press ENTER one more time: "; a$
  54. CALL WCLOSE(w1)
  55.  
  56.