wxSlider: disabling mouse wheel

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
papillon68
Experienced Solver
Experienced Solver
Posts: 76
Joined: Tue Nov 06, 2007 11:19 pm

wxSlider: disabling mouse wheel

Post by papillon68 » Mon Dec 02, 2019 11:35 pm

Hello, I searched information around but couldn't find if it's possible at all to deny wxSlider changes using the mouse wheel. Thanks
Windows 10, MS VC++ 2015 (vc140), WxWidgets 3.11

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 3580
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxSlider: disabling mouse wheel

Post by ONEEYEMAN » Tue Dec 03, 2019 3:26 pm

Hi,
What platform/wx version?
Did you try to bind mouse event and do nothing in the handler?

Thank you.

papillon68
Experienced Solver
Experienced Solver
Posts: 76
Joined: Tue Nov 06, 2007 11:19 pm

Re: wxSlider: disabling mouse wheel

Post by papillon68 » Tue Dec 03, 2019 3:30 pm

Hi, I am on Windows 10/ wxWidgets 3.13
Yes I did connect the mouse wheel event to an empty function, without success. Here below is code showing the connections:

Code: Select all

Connect(CLOROFILLAWIDGET_SLIDERCONTROLLER, wxEVT_SCROLL_CHANGED, wxScrollEventHandler(ClorofillaSlider::OnRelease)); // connect scroll event
clorofillaSliderController->Bind(wxEVT_MOUSEWHEEL, &ClorofillaSlider::OnWheelDoNothing, this);	// catch wheel event
Windows 10, MS VC++ 2015 (vc140), WxWidgets 3.11

papillon68
Experienced Solver
Experienced Solver
Posts: 76
Joined: Tue Nov 06, 2007 11:19 pm

Re: wxSlider: disabling mouse wheel

Post by papillon68 » Tue Dec 03, 2019 11:11 pm

I've "fixed" it using a boolean to intercept the wheel event, and when it's true I restore the slider value to it's precedent one. It's kind of a hack but it does what I need.
Windows 10, MS VC++ 2015 (vc140), WxWidgets 3.11

Post Reply