What would be the best way to capture an event WHILE the user is scrolling the scrollbars of a ScrollAreaGadget? #WM_ACTIVATE only works when the user initially clicks the scrollbar and then later lets go, and #WM_MOUSEMOVE also stops reporting while the user is moving a scrollbar.
I need to be able to track the #PB_ScollArea_X and #PB_ScrollArea_Y while it is being moved by the user, rather than just after the user has let go of the mouse button and chosen a final landing position.
Is there an easy way to do this? Thanks...
Event for scrolling of ScrollAreaGadget?
Re: Event for scrolling of ScrollAreaGadget?
#WM_HSCROLL, #WM_VSCROLL and #WM_MOUSEWHEEL are probably what you are after. You'll need to subclass the scrollarea first though.
I may look like a mule, but I'm not a complete ass.
Re: Event for scrolling of ScrollAreaGadget?
Thanks.. So far I haven't had any luck getting the #WM_VSCROLL/#WM_HSCROLL messages to show up, but my knowledge of the API is admittedly very limited. Is there an example that you know of anywhere that might provide further guidance?srod wrote:#WM_HSCROLL, #WM_VSCROLL and #WM_MOUSEWHEEL are probably what you are after. You'll need to subclass the scrollarea first though.
- Arctic Fox
- Enthusiast
- Posts: 609
- Joined: Sun Dec 21, 2008 5:02 pm
- Location: Aarhus, Denmark
Re: Event for scrolling of ScrollAreaGadget?
Try this
Code: Select all
Global OldSubclass
Procedure ScrollCallback(Handle, Message, wParam, lParam)
Select Message
Case #WM_HSCROLL
Debug "#WM_HSCROLL"
Case #WM_VSCROLL
Debug "#WM_VSCROLL"
EndSelect
ProcedureReturn CallWindowProc_(OldSubclass, Handle, Message, wParam, lParam)
EndProcedure
OpenWindow(0, 100, 100, 300, 300, "")
ScrollAreaGadget(0, 5, 5, 290, 290, 500, 500, 30)
StringGadget(1, 5, 5, 100, 20, "Gadget 1")
StringGadget(2, 305, 405, 100, 20, "Gadget 2")
CloseGadgetList()
OldSubclass = SetWindowLong_(GadgetID(0), #GWL_WNDPROC, @ScrollCallback())
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
End
Re: Event for scrolling of ScrollAreaGadget?
Thanks Arctic Fox, that's great and much appreciated. I am learning the API a little at a time, but callbacks and subclassing are still mostly foreign to me so I wouldn't likely have stumbled onto the right syntax without assistance.
- Arctic Fox
- Enthusiast
- Posts: 609
- Joined: Sun Dec 21, 2008 5:02 pm
- Location: Aarhus, Denmark
Re: Event for scrolling of ScrollAreaGadget?
You are welcome
When you are ready to learn more about subclassing, you should definitely have a look at srod's tutorial (see the nxSoftware website.)

When you are ready to learn more about subclassing, you should definitely have a look at srod's tutorial (see the nxSoftware website.)
Re: Event for scrolling of ScrollAreaGadget?
Wow, I just read through the entire thing and it was both extremely helpful and excellently written. Thanks for the direction to it and thanks srod for writing it in the first place. Though the API in general is still somewhat of a big daunting dragon to me, I now feel that I am at least equipped with a nice shiny new dagger with which to do battle, as opposed to the wooden toothpick I was brandishing before. Perhaps someday I'll wield a powerful broadsword like srod does but I wouldn't count on it anytime soon!Arctic Fox wrote:You are welcome![]()
When you are ready to learn more about subclassing, you should definitely have a look at srod's tutorial (see the nxSoftware website.)
