// AmigaCOMAL v3.4 // Mouse Button Demo // Press left mouse button and you will get the position // Move mouse while button is pressed // ---------------------------------------------------------- // I've extended this MouseDemo Code a bit because originally // close to all this examples are using AmigaCOMAL IO Screen // in addition to whatever you create. // I find that distractive and have modify the code slightly to // show the mouse coordinates on the screen which was created // as DemoWindow! // USE CITScreen USE CITWindow USE CITText DIM Error OF SHORT DIM MouseMoveEvent OF SHORT DIM Text OF CITText Text.Position(10,10) Text.Size(260,20,DOWN) DIM DemoWindow OF CITWindow DemoWindow.Label("Mouse Coordinates") DemoWindow.Position(50,20) DemoWindow.Size(530,150) DemoWindow.CloseGadget DemoWindow.DragBar DemoWindow.SizingGadget DemoWindow.DepthGadget DemoWindow.Activate DemoWindow.SelectEventHandler(Button(,,)) DemoWindow.PointerEventHandler(MouseMove(,)) ComalScreen.InsObject(DemoWindow,Error) DemoWindow.InsObject(Text,Error) IF Error THEN STOP "Couldn't open the window" ENDIF DemoWindow.MouseMove(TRUE) WHILE NOT DemoWindow.ClosePressed DO WAIT ComalScreen.RemObject(DemoWindow) PROC Button(Down OF BYTE,x OF FLOAT,y OF FLOAT) IF Down THEN IF NOT MouseMoveEvent THEN MouseMoveEvent:=TRUE DemoWindow.MouseMove(TRUE) ENDIF ELSE MouseText IF MouseMoveEvent THEN MouseMoveEvent:=FALSE DemoWindow.MouseMove(FALSE) ENDIF ENDIF ENDPROC Button PROC MouseMove(x OF FLOAT,y OF FLOAT) MouseText ENDPROC MouseMove PROC MouseText Coo$:="MOUSE X: MOUSE Y: " Text.PenColor(9) Text.Print(10,7,Coo$) Text.PenColor(15) Text.Print(80,7,STR$(x)) Text.Print(190,7,STR$(y)) ENDPROC MouseText