How long have canvas mouse events been broken?

BlitzMax Forums/BlitzMax GUI Programming/How long have canvas mouse events been broken?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Hmm, curious me and Azazoth are only 2 suffering the mousemove stream.

Seb, your dragging wasn't working the best here, this one seems to track ok, although we need someway of bringing canvas gadgets to the front, perhaps activategadget could do the job for panel/canvas gadgets or a new setgadgetorder command.

' createcanvas.bmx

Framework brl.win32maxgui
Import brl.eventqueue
Import brl.d3d7max2d
'Import brl.glmax2d
Import brl.timer

Strict 

Global GAME_WIDTH=720
Global GAME_HEIGHT=480

' create a centered window with client size GAME_WIDTH,GAME_HEIGHT

Local wx=(ClientWidth(Desktop())-GAME_WIDTH)/2
Local wy=(ClientHeight(Desktop())-GAME_HEIGHT)/2

Local window:TGadget=CreateWindow("My Canvas",wx,wy,GAME_WIDTH,GAME_HEIGHT,Null,WINDOW_TITLEBAR|WINDOW_CLIENTCOORDS)

' create a canvas for our game

Local canvas:TGadget=CreateCanvas(0,0,320,240,window)
Local canvas1:TGadget=CreateCanvas(340,140,320,240,window)

' create an update timer
Local picked:TGadget
Local handlex,handley

CreateTimer 1

While WaitEvent()
	Local src:TGadget=TGadget(EventSource())
	DebugLog CurrentEvent.toString()
	Select EventID()
		Case EVENT_TIMERTICK
			RedrawGadget canvas
			RedrawGadget canvas1


		Case EVENT_GADGETPAINT
			SetGraphics CanvasGraphics(src)
			SetOrigin 160,120
			SetLineWidth 5
			Cls
			Local t=MilliSecs()
			DrawLine 0,0,120*Cos(t),120*Sin(t)
			DrawLine 0,0,80*Cos(t/60),80*Sin(t/60)
			Flip
			
		Case EVENT_MOUSEDOWN
			picked=src
			handlex=EventX()
			handley=EventY()

		Case EVENT_MOUSEUP
			picked=Null

		Case EVENT_MOUSEMOVE
			If picked
				Local mx=EventX()+GadgetX(picked)-handlex
				Local my=EventY()+GadgetY(picked)-handley
				SetGadgetShape(src,mx,my,GadgetWidth(picked),GadgetHeight(picked))
			EndIf

		Case EVENT_WINDOWCLOSE
			FreeGadget canvas
			End

		Case EVENT_APPTERMINATE
			End
	End Select
Wend