How would I use EVENT_MOUSEDOWN in my program so that the mouse is actually held down, rather than used just as a click? It seems whenever I use this it always acts as a MouseHit rather than a MouseDown.
MaxGUI: EVENT_MOUSEDOWN
BlitzMax Forums/BlitzMax Beginners Area/MaxGUI: EVENT_MOUSEDOWN Exactly what I was about to say. Basically, use a variable to keep track of whether or not the mouse button is down. Below, the variable varMouseDown is 1 when the mouse button is down, and 0 when it isn't.
SuperStrict Global wndMain:TGadget = CreateWindow("Test Window", 100, 100, 400, 300, Null, 11) Global gadPanel:TGadget = CreatePanel(0,0,ClientWidth(wndMain),ClientHeight(wndMain),wndMain,PANEL_ACTIVE) SetPanelColor(gadPanel,255,0,0) 'So that you can see the panel and know it is there SetGadgetLayout(gadPanel,1,1,1,1) 'Make sure the panel stretches when panel is resized Local varCount:Int = 0 Local varMouseDown:Int = 0 Repeat Select PollEvent() Case EVENT_MOUSEDOWN ; If EventSource() = gadPanel Then varMouseDown = 1 Case EVENT_MOUSEUP ; If EventSource() = gadPanel Then varMouseDown = 0 Case EVENT_WINDOWCLOSE ; End EndSelect If varMouseDown Then 'If mouse is currently held down then do something varCount:+1 SetStatusText(wndMain,"Count: " + varCount) EndIf Forever
..except that it's better to have a dedicated var for each mousebutton :P
hence: lmd, rmd ..
Note that this lmd or rmd doesn't create an event, if you want to draw lines or pixels at a constant rate (like drawing dark pixels that become lighter on the same place) then you want this 'If lmd (..) EndIf'-construction inside a timer event ..
hence: lmd, rmd ..
Note that this lmd or rmd doesn't create an event, if you want to draw lines or pixels at a constant rate (like drawing dark pixels that become lighter on the same place) then you want this 'If lmd (..) EndIf'-construction inside a timer event ..
That works, thanks.