custom wxSlider

Are you writing your own components and need help with how to set them up or have questions about the components you are deriving from ? Ask them here.
Post Reply
madushikasewwandi
In need of some credit
In need of some credit
Posts: 1
Joined: Mon Feb 09, 2015 11:56 am

custom wxSlider

Post 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
Manolo
Can't get richer than this
Can't get richer than this
Posts: 827
Joined: Mon Apr 30, 2012 11:07 pm

Re: custom wxSlider

Post 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.
User avatar
ggbutcher
Earned a small fee
Earned a small fee
Posts: 12
Joined: Tue Aug 08, 2017 11:37 pm

Re: custom wxSlider

Post 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...
Post Reply