trying to figure out how to update a text gadget to display the x y when entering the canvas of the mouse postion within the canvas as a thread perhaps???
any ideas suggestions?
mouse x y canvas update loop
-
IdeasVacuum
- Always Here

- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: mouse x y canvas update loop
Like This?
Code: Select all
Enumeration
#GADGET_Canvas
#GADGET_Text
EndEnumeration
If OpenWindow(0, 0, 0, 500, 400, "Canvas XY", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
CanvasGadget(#GADGET_Canvas, 10, 10, 380, 380, #PB_Canvas_ClipMouse)
TextGadget(#GADGET_Text, 400, 10, 80, 20,"")
SetGadgetAttribute(#GADGET_Canvas, #PB_Canvas_Cursor, #PB_Cursor_Cross)
Repeat
Event = WaitWindowEvent()
If Event = #PB_Event_Gadget
Select EventGadget()
Case #GADGET_Canvas
X = GetGadgetAttribute(#GADGET_Canvas, #PB_Canvas_MouseX)
Y = GetGadgetAttribute(#GADGET_Canvas, #PB_Canvas_MouseY)
SetGadgetText(#GADGET_Text,"X" + Str(X) + " Y" + Str(Y))
EndSelect
EndIf
Until Event = #PB_Event_CloseWindow
EndIf
End
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
-
ehowington
- Enthusiast

- Posts: 117
- Joined: Sat Sep 12, 2009 3:06 pm