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.
madushikasewwandi
In need of some credit
In need of some credit
Posts: 1
Joined: Mon Feb 09, 2015 11:56 am

custom wxSlider

Postby madushikasewwandi » Thu Feb 12, 2015 8:53 am

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
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 518
Joined: Mon Apr 30, 2012 11:07 pm

Re: custom wxSlider

Postby Manolo » Thu Feb 12, 2015 6:16 pm

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
In need of some credit
In need of some credit
Posts: 8
Joined: Tue Aug 08, 2017 11:37 pm

Re: custom wxSlider

Postby ggbutcher » Sat Aug 12, 2017 3:37 am

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


Return to “Component Writing”

Who is online

Users browsing this forum: No registered users and 1 guest