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