wxSlider with two thumbs Topic is solved
-
- Ultimate wxWidgets Guru
- Posts: 539
- Joined: Fri May 22, 2009 8:52 am
- Location: Bremen, Germany
wxSlider with two thumbs
hi,
is there such a thing as a wxSlider with two thumbs? i want to enable the user to set a range between two extreme int values. i.e. minimum = 10 and maximum = 1000, the user can set a range from 247 to 830.
can i create a slider with two thumbs?
maybe there is a better way?
thank you!
is there such a thing as a wxSlider with two thumbs? i want to enable the user to set a range between two extreme int values. i.e. minimum = 10 and maximum = 1000, the user can set a range from 247 to 830.
can i create a slider with two thumbs?
maybe there is a better way?
thank you!
Re: wxSlider with two thumbs
Only supported under MSW, check the wxSL_SELRANGE style for wxSlider.
Use the source, Luke!
- eranon
- Can't get richer than this
- Posts: 867
- Joined: Sun May 13, 2012 11:42 pm
- Location: France
- Contact:
Re: wxSlider with two thumbs
Hello, Outside of MSW, a kind of workaround there: https://stackoverflow.com/questions/297 ... e-on-linux
Where jordan9001 says:
Where jordan9001 says:
You could have two sliders; one that will push the other so it remains lower, and one will remain higher?
I know it isn't the same thing, sorry, but it is an option. So when ever self.minSlider is moved, you bind wx.EVT_SCROLL with a function that will do something like:
and vice-versa for the maxSlider.Code: Select all
self.minSlider.Bind(wx.EVT_SCROLL, self.respondSliderChange()) def respondSliderChange(self): if self.minSlider.GetValue() >= self.maxSlider.GetValue(): self.maxSlider.SetValue(self.minSlider.GetValue()+1)
Besides that, you can look into creating a custom widget here.
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]
-
- Ultimate wxWidgets Guru
- Posts: 539
- Joined: Fri May 22, 2009 8:52 am
- Location: Bremen, Germany
Re: wxSlider with two thumbs
That seems perfect because my program is windows only. But the only change I see is a thicker slider bar?! No second thumb, so how can this select a range?!doublemax wrote:Only supported under MSW, check the wxSL_SELRANGE style for wxSlider.
Re: wxSlider with two thumbs
Sorry for putting you on the wrong track. After reading up on it, it turns out that this only enables you to display a visible range in the slider. But this can't be controlled by the user directly.
Use the source, Luke!
Re: wxSlider with two thumbs
Hi,
Why do you need 2 thumbs?
As a workaround you could try to have 2 slider controls - 1 for a minimum value and 1 for maximum value. This will be much better UI/UX than having 2 thumbs which will confuse people.
Thank you.
Why do you need 2 thumbs?
As a workaround you could try to have 2 slider controls - 1 for a minimum value and 1 for maximum value. This will be much better UI/UX than having 2 thumbs which will confuse people.
Thank you.
-
- Ultimate wxWidgets Guru
- Posts: 539
- Joined: Fri May 22, 2009 8:52 am
- Location: Bremen, Germany
Re: wxSlider with two thumbs
I want to enable the user to limit minimum and maximum for x and y coordinates, so I am using four sliders at the moment. These use a lot of space, I want to use as few controls as possible, and I think a two thumb slider would be very intuitive (at least for the x values with a horizontal slider).
left slider always stays at least one tick left of the right slider, the values are shows left and right beside the slider. I guess I will have to build a custom one.
left slider always stays at least one tick left of the right slider, the values are shows left and right beside the slider. I guess I will have to build a custom one.
- eranon
- Can't get richer than this
- Posts: 867
- Joined: Sun May 13, 2012 11:42 pm
- Location: France
- Contact:
Re: wxSlider with two thumbs
In last resort, you could manage a double-thumb slider in a wxWebView (e.g. http://jsfiddle.net/abhitalks/a1f1k8d0/2/ and a lot of ways around searching on keywords like "javascript slider two thumbs") then acquire back the values at every change... But, of course, it's a little convoluted
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]
-
- Ultimate wxWidgets Guru
- Posts: 539
- Joined: Fri May 22, 2009 8:52 am
- Location: Bremen, Germany
Re: wxSlider with two thumbs
interesting, thank you.eranon wrote:In last resort, you could manage a double-thumb slider in a wxWebView (e.g. http://jsfiddle.net/abhitalks/a1f1k8d0/2/ and a lot of ways around searching on keywords like "javascript slider two thumbs") then acquire back the values at every change... But, of course, it's a little convoluted
i am in the process of creating my own control. i have some classes using wxDragBitmap already, so it should work using these. unfortunately it seemed unpractical to inherit from wxSlider because it seems to be only a shell (is this the correct word?!) for os specific controls. i did not see an easy way to add a second thumb there.
if anyone needs the same thing and would like to have my source code, just send me a message or post here.
thanx everyone for your input!
- eranon
- Can't get richer than this
- Posts: 867
- Joined: Sun May 13, 2012 11:42 pm
- Location: France
- Contact:
Re: wxSlider with two thumbs
It's not an issue, it's a feature! It's one of the top quality of wxWidgets to rely on native controls... So, of course, by design, most of the time (unless when it's already possible with the OS's API itself), you can't change the native behavior of the controls.mael15 wrote:unfortunately it seemed unpractical to inherit from wxSlider because it seems to be only a shell (is this the correct word?!) for os specific controls. i did not see an easy way to add a second thumb there.
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]
Re: wxSlider with two thumbs
I wrote one to implement a black/white point setter for an image processing program. You can find it here:
https://github.com/butcherg/rawproc/blob/master/src/
Look for myDoubleSlider.cpp, my DoubleSlider.h
https://github.com/butcherg/rawproc/blob/master/src/
Look for myDoubleSlider.cpp, my DoubleSlider.h