Page 1 of 1

custom wxSlider

Posted: Thu Feb 12, 2015 8:53 am
by madushikasewwandi
I want to write a custom wxSlider to use as a Color Slider, where we can set color to the bar of the slider.

But I dont have an idea where to start.
please help

Thanks.
masudhika

Re: custom wxSlider

Posted: Thu Feb 12, 2015 6:16 pm
by Manolo
Try SetForegroundColour inherited from wxWindow. I haven't tried it. According to docs:
The meaning of foreground colour varies according to the window class; it may be the text colour or other colour, or it may not be used at all. Additionally, not all native controls support changing their foreground colour so this method may change their colour only partially or even not at all.

Re: custom wxSlider

Posted: Sat Aug 12, 2017 3:37 am
by ggbutcher
madushikasewwandi wrote:I want to write a custom wxSlider to use as a Color Slider, where we can set color to the bar of the slider.

But I dont have an idea where to start.
please help

Thanks.
masudhika
So, to make sure I understand the problem, you want a slider that will pick a color from a range of colors.

I messed around with the Windows Paint Edit Colors dialog for perspective, what they're doing is a three-dimensional pick of hue, saturation, and luminance values (HSL) with a HS grid and a L slider. Note they're using a 0-255 range for the H, S, and L values, so you could make three wxSliders, one for H, S, and L, with lower limit of 0, upper limit of 255.

If you want a single slider to pick from a 0-255 range, you could hard-code S and L values to, say, the mid-point of 128, and just slide from 0-255 on H. That'd transition from reds through greens and blues to a sort of purple...