home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / basic / pbvl010.zip / TUTOR3_2.BAS < prev    next >
BASIC Source File  |  1994-02-10  |  3KB  |  121 lines

  1. '┌─────────────────────────────────────────────────────────────────────────┐
  2. '│    FILE: TUTOR3_2.BAS                                                   │
  3. '│ PURPOSE: PB/VISION(tm) LITE Tutorial Example Program                    │
  4. '├─────────────────────────────────────────────────────────────────────────┤
  5. '│ For instant help on any PB/VISION(tm) keyword, place the cursor on that │
  6. '│ keyword and press <CTRL-F1>.  The PB/VISION(tm) index can be accessed   │
  7. '│ by pressing <SHIFT-F1> twice.  The file "PBVLITE.PBH" _must_ be in the  │
  8. '│ same directory as the PowerBASIC IDE (PB.EXE) for this feature to work  │
  9. '│ properly.                                                               │
  10. '└─────────────────────────────────────────────────────────────────────────┘
  11.  
  12. %ISPBU = 0
  13.  
  14. DEFINT A-Z
  15. $DYNAMIC
  16.  
  17. $INCLUDE ".\WINDOW.BI"
  18. $INCLUDE ".\EVENT.BI"
  19. $INCLUDE ".\MOUSE.BI"
  20.  
  21.     DIM thisWin AS SHARED INTEGER
  22.  
  23.     APP.GRAPHICSMODE = 1
  24.     APP.GRAPHICSMOUSE = 1
  25.  
  26.     APPTITLE &HB0, "THE NEXT STEP IN MULTI-THREADING"
  27.  
  28.     APPINIT
  29.  
  30.     GottaMouse% = MOUSEINIT(buttons%)
  31.     MOUSECURSORON
  32.  
  33.     winflags = %SHADOW OR %DRAGBAR OR %CONTROL OR %RESIZE OR %MINMAX
  34.  
  35.     thisWin% = WINPOPUP(1, 1, 10, 50, &H9F, 1, &H9F, "ThisRoutine() Window", &HCF, winflags)
  36.     thatWin% = WINPOPUP(13, 29, 10, 50, &HF0, 1, &HF1, "ThatRoutine() Window", &HB0, winflags)
  37.  
  38.     WININSTALLCODE thisWin%, CODESEG(ThisRoutine), CODEPTR(ThisRoutine)
  39.     WININSTALLCODE thatWin%, CODESEG(ThatRoutine), CODEPTR(ThatRoutine)
  40.  
  41.     DO
  42.  
  43.         eventNo = GETEVENT(0)
  44.  
  45.         SELECT CASE eventNo
  46.  
  47.             CASE 102
  48.                 EXIT DO
  49.  
  50.             CASE ELSE
  51.  
  52.         END SELECT
  53.  
  54.     LOOP
  55.  
  56.     MOUSECURSOROFF
  57.     APPCLOSE
  58.  
  59.     END
  60.  
  61. FUNCTION ThatRoutine% (BYVAL handle%, BYVAL eventNo%, BYVAL parm1%, BYVAL parm2%)
  62.  
  63.     SELECT CASE eventNo
  64.  
  65.         CASE 200                ' got focus event
  66.             WINWRITE handle, "GOT FOCUS - "
  67.  
  68.         CASE 201                ' lost focus event
  69.             WINWRITE handle, "LOST FOCUS - "
  70.  
  71.         CASE 202                ' click event
  72.             WINWRITE handle, "CLICK - "
  73.  
  74.         CASE 203                ' control box clicked
  75.             eventNo% = 102
  76.  
  77.         CASE 217                ' window clicked while minimized
  78.             WINNORMALIZE handle
  79.  
  80.         CASE ELSE
  81.  
  82.     END SELECT
  83.  
  84.     WINWRITELN handle%, "Event" + STR$(eventNo%) + " in ThatRoutine()"
  85.  
  86.     ThatRoutine% = eventNo%         ' return the event code
  87.  
  88. END FUNCTION
  89.  
  90. FUNCTION ThisRoutine% (BYVAL handle%, BYVAL eventNo%, BYVAL parm1%, BYVAL parm2%)
  91.  
  92. ' ─ ■ 6.2.1 - SOME NEW EVENT CODES ───────────────────────────────────────
  93.  
  94.     SELECT CASE eventNo
  95.  
  96.         CASE 200                ' got focus event
  97.             WINWRITE handle, "GOT FOCUS - "
  98.  
  99.         CASE 201                ' lost focus event
  100.             WINWRITE handle, "LOST FOCUS - "
  101.  
  102.         CASE 202                ' click event
  103.             WINWRITE handle, "CLICK - "
  104.  
  105.         CASE 203                ' control box clicked
  106.             eventNo% = 102
  107.  
  108.         CASE 217                ' window clicked while minimized
  109.             WINNORMALIZE handle
  110.  
  111.         CASE ELSE
  112.  
  113.     END SELECT
  114.  
  115.     WINWRITELN handle%, "Event" + STR$(eventNo%) + " in ThisRoutine()"
  116.  
  117.     ThisRoutine% = eventNo%         ' return this event code
  118.  
  119. END FUNCTION
  120.  
  121.