Decomposing mouse action on a wxSlider Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
remi
Knows some wx things
Knows some wx things
Posts: 26
Joined: Fri Nov 25, 2005 10:49 pm

Decomposing mouse action on a wxSlider

Post by remi »

Hi

I would like to decompose the user's mouse action on a wxSlider in 3 phases :

- Action start : The user left click on the thumb of the wxSlider
- Action process : The user drag the thumb of the wxSlider
- Action end : The user release the mouse button

It is actually posssible to catch the "Action process" and "Action end" using the provided event handlers, but I don't see how to do the "Action start".

I can derive the wxSlider class if needed.

Many thanks

Rémi
User avatar
doublemax
Moderator
Moderator
Posts: 19114
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Decomposing mouse action on a wxSlider

Post by doublemax »

Isn't the first wxEVT_SCROLL_THUMBTRACK enough? At least under Windows, the underlying native control does not send an event as soon as the mouse button is pressed down. Only when the user starts dragging.

If you want that behaviour, you probably have to re-implement a whole slider from scratch.
Use the source, Luke!
remi
Knows some wx things
Knows some wx things
Posts: 26
Joined: Fri Nov 25, 2005 10:49 pm

Re: Decomposing mouse action on a wxSlider

Post by remi »

Yes but how to know that it is the first one ? One solution maybe would be to add a "state flag" that could be reseted at "release" event.

Is there some ways to store such a data (user data) inside a built-in wxSlider ? Or should I derive the class and add a member in it ?

Thanks
User avatar
doublemax
Moderator
Moderator
Posts: 19114
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Decomposing mouse action on a wxSlider

Post by doublemax »

Yes, you'll need a flag somewhere. For a clean solution you can subclass wxSlider and handle it there. For most purposes it's probably sufficient to handle that in the parent frame (or wherever you handle he slider events).
Use the source, Luke!
Post Reply