Hi! When i have a standard event for a trackbar, even if i hold down the mouse on the trackbar and drags, the events are sent to it. How can i make an event only occour when the trackbar is released from a "draggin' "
Thanks.
trackbar status on release!
Re: trackbar status on release!
This works... try it with and without the GetAsyncKeyState command! 

Code: Select all
If OpenWindow(0,200,200,450,200,#PB_Window_SystemMenu,"test")
CreateGadgetList(WindowID())
TrackBarGadget(1,10,10,200,30,1,10,#PB_TrackBar_Ticks)
TextGadget(2,10,50,50,20,"1")
Repeat
ev=WaitWindowEvent()
If ev=#PB_Event_Gadget And GetAsyncKeyState_(#VK_LBUTTON)=0
SetGadgetText(2,Str(GetGadgetState(1)))
EndIf
Until ev=#PB_EventCloseWindow
EndIf
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
"PureBasic won't be object oriented, period" - Fred.
- Joakim Christiansen
- Addict
- Posts: 2452
- Joined: Wed Dec 22, 2004 4:12 pm
- Location: Norway
- Contact:
Here's another way:
Code: Select all
Procedure MyWindowCallback(WindowID, Message, wParam, lParam)
Result = #PB_ProcessPureBasicEvents
Select message
Case #WM_HSCROLL
If lParam=GadgetID(1) And wParam&$ffff=#SB_ENDSCROLL
SetGadgetText(2,Str(GetGadgetState(1)))
EndIf
EndSelect
ProcedureReturn Result
EndProcedure
If OpenWindow(0,200,200,450,200,"",#PB_Window_SystemMenu)
CreateGadgetList(WindowID(0))
TrackBarGadget(1,10,10,200,30,1,10,#PB_TrackBar_Ticks)
TextGadget(2,10,50,50,20,"1")
SetWindowCallback(@MyWindowCallback())
Repeat
ev=WaitWindowEvent()
Until ev=#PB_Event_CloseWindow
EndIf
I may look like a mule, but I'm not a complete ass.