home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / COMAL3-1.DMS / in.adf / CITDemos / CITMouse < prev    next >
Encoding:
Text File  |  1993-03-30  |  1.1 KB  |  49 lines

  1. // Mouse button demo
  2. //
  3. // Press left mouse button and you will get the position
  4. // Move mouse while button is pressed
  5.  
  6. USE CITScreen
  7. USE CITWindow
  8.  
  9. DIM Error OF SHORT
  10. DIM MouseMoveEvent OF SHORT
  11.  
  12. DIM DemoWindow OF CITWindow
  13. DemoWindow.Position(50,20)
  14. DemoWindow.Size(530,150)
  15. DemoWindow.CloseGadget
  16. DemoWindow.DragBar
  17. DemoWindow.SizingGadget
  18. DemoWindow.DepthGadget
  19. DemoWindow.Activate
  20. ComalScreen.InsObject(DemoWindow,Error)
  21. IF Error THEN
  22.   STOP "Could'nt open the window"
  23. ENDIF
  24. DemoWindow.SelectEventHandler(Button(,,))
  25. DemoWindow.PointerEventHandler(MouseMove(,))
  26.  
  27. WHILE NOT DemoWindow.ClosePressed DO WAIT 
  28.  
  29. ComalScreen.RemObject(DemoWindow)
  30.  
  31. PROC Button(Down OF BYTE,x OF SHORT,y OF SHORT)
  32.   IF Down THEN
  33.     IF NOT MouseMoveEvent THEN
  34.       MouseMoveEvent:=TRUE
  35.       DemoWindow.MouseMove(TRUE)
  36.     ENDIF
  37.     PRINT AT 20,5: USING "x = -### ,  y = -###": x,y,
  38.   ELSE
  39.     IF MouseMoveEvent THEN
  40.       MouseMoveEvent:=FALSE
  41.       DemoWindow.MouseMove(FALSE)
  42.     ENDIF
  43.   ENDIF
  44. ENDPROC Button
  45.  
  46. PROC MouseMove(x OF SHORT,y OF SHORT)
  47.   PRINT AT 20,5: USING "x = -### ,  y = -###": x,y,
  48. ENDPROC MouseMove
  49.