This already works with PB "TrackBar Gadget", so i assume it is created with the CreateSliderControl() API with the "liveTracking" parameter set to "True".
Code sample to illustrate this (try to drag the sliders/scrollbars) :
Code: Select all
ImportC "/System/Library/Frameworks/Carbon.framework/Carbon"
NewControlActionUPP.l(*userRoutine)
SetControlAction(theControl.l, actionProc.l)
CreateScrollBarControl(window.l, *boundsRect, value.l, minimum.l, maximum.l, viewSize.l, liveTracking.b, liveTrackingProc.l, *outControl)
ShowControl(theControl.l)
EndImport
Structure Rect
top.w
left.w
bottom.w
right.w
EndStructure
OpenWindow(0, 100, 100, 500, 200, "Test")
TrackBarGadget(0, 10, 10, 200, 20, 0, 10)
TextGadget(1, 230, 10, 200, 20, "'normal' slider")
TrackBarGadget(2, 10, 50, 200, 20, 0, 10)
TextGadget(3, 230, 50, 200, 20, "'live' slider")
ScrollBarGadget(4, 10, 90, 200, 20, 0, 10, 1)
TextGadget(5, 230, 90, 200, 20, "'normal' scrollbar")
ScrollBarGadget(6, 10, 130, 200, 20, 0, 10, 1)
TextGadget(7, 230, 130, 200, 20, "'live' scrollbar (does not work)")
Rect.Rect : Rect\left = 10 : Rect\top = 170 : Rect\right = 210 : Rect\bottom = 190
CreateScrollBarControl(WindowID(0), @Rect, 0, 0, 10, 1, #True, #Null, @APIScrollBar)
ShowControl(APIScrollBar)
TextGadget(8, 230, 170, 200, 20, "API created 'live' scrollbar")
ProcedureCDLL LiveTrackingProc()
EndProcedure
ControlActionUPP = NewControlActionUPP(@LiveTrackingProc())
SetControlAction(GadgetID(2), ControlActionUPP)
SetControlAction(GadgetID(6), ControlActionUPP)
SetControlAction(APIScrollBar, ControlActionUPP)
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow