How do you change the current color from clientside?

This post has 1 reply

Top 50 Contributor
Posts: 94
hfokkinga Posted: Fri Oct 10, 2008 @ 2:27 AM

I try to change the selected color from the client site using the following code:

ColorPicker1.set_selectedColor(new ComponentArt.Web.UI.ColorPickerColor('FF0000'));

But this does not work. So how can you change the selected color from the client side?

I am trying to make a slider colorpicker, with underneath three custom sliders (RGB). This all works except for changing the colorpicker when the user changes one of the rgb sliders.

I think an example with rgb sliders would be great, because that is very common when you present a colorpicker to an user.
Top 10 Contributor
Posts: 6,463
hwan Posted: Fri Oct 10, 2008 @ 1:29 PM
I've asked the demo team to look into adding this example.

If you're still trying to build one, you can use the Slider's valueChanged client event to update your ColorPicker.

Somet thing like:
function Slider_onValueChanged(sender, e)
var colorDecimal = (255-SliderRed.get_value()) + (256 * (255-SliderGreen.get_value())) + (65536 * (255-SliderBlue.get_value()));

ColorPicker1.set_selectedColor( new ComponentArt.Web.UI.ColorPickerColor(colorDecimal.toString(16)) );

I started working on one, but had trouble with the ColorPicker invoking a Slider.moveTo(), which raises the valueChanged, which raises the ColorPicker's colorChanged etc.
Page 1 of 1 (2 items)