This is a migrated thread and some comments may be shown as answers.

Apply button in HSV and HSB modes

8 Answers 135 Views
ColorPicker
This is a migrated thread and some comments may be shown as answers.
Marc Johnston
Top achievements
Rank 1
Marc Johnston asked on 26 May 2010, 07:02 PM
The web palette mode does not require the user to press an Apply button.  This is what I am looking for.  The HSV and HSB modes require the user to press the apply button.  Can I remove this functionality?  I see an idea where I can hide the apply button using CSS but then the color doesn't get returned by the selected color property. 

8 Answers, 1 is accepted

Sort by
0
Tsvetie
Telerik team
answered on 31 May 2010, 04:08 PM
Hello Marc Johnston,
You can use the following approach:
<head runat="server">
    <title></title>
    <style type="text/css">
        .NoColorButton .rcpApplyButton
        {
            display: none !important;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <telerik:RadColorPicker ID="RadColorPicker1" runat="server" CssClass="NoColorButton"
        PaletteModes="HSV" OnClientColorPreview="OnClientColorPreview">
    </telerik:RadColorPicker>
 
    <script type="text/javascript">
    function OnClientColorPreview(colorPicker, args)
    {
        var color = args.get_color();
        colorPicker._selectedColor = color;
        colorPicker.updateClientState();
    }
    </script>
    </form>
</body>

Regards,
Tsvetie
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Pat
Top achievements
Rank 1
answered on 05 Aug 2016, 05:21 AM

Hi Guys,

added to this - kind of the continuation to this question - When I set the selected colour in the code behind and want to change it in the front end I have to press the Reset/No Color Button first to "unlock" the colour field and hash code field (rcphexinput). Is there a way that the field starts changing immediately when moving the cursor (the same way it behaves if the SelectedColor property wasn't set).

In short I don't want to use any buttons at all neither for reset nor for apply.

Thanks

Pat

0
Marin Bratanov
Telerik team
answered on 09 Aug 2016, 11:14 AM

Hello Pat,

You should be able to immediately change the color. I am attaching here a small sample and a short video that show the expected behavior:

<telerik:RadColorPicker runat="server" ID="RadColorPicker1" PaletteModes="All"></telerik:RadColorPicker>
<asp:Button ID="Button1" Text="get currently selected color" OnClick="Button1_Click" runat="server" />
<asp:Label ID="Label1" Text="" runat="server" />
protected void Page_Load(object sender, EventArgs e)
{
    if(!Page.IsPostBack)
    {
        RadColorPicker1.SelectedColor = System.Drawing.Color.Red;
        Button1_Click(null, null);
    }
}
 
protected void Button1_Click(object sender, EventArgs e)
{
    Label1.Text = RadColorPicker1.SelectedColor.ToString();
}

Can you confirm that the Selected Color is not being set again by another event or logic, that there are no JS errors and that you are using the latest version (R2 2016 SP1 at the time of writing)?

Regards,

Marin Bratanov
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
Pat
Top achievements
Rank 1
answered on 11 Aug 2016, 04:14 PM

Hi Marin,

sorry for the late reply - I am currently traveling...

First of all - thanks for the awesome reply with the Video etc.!!! much appreciated - you guys rock!

Unfortunately I have to tell you the issue still persists, even in a brand new empty default VS Webforms application - here is what I did:

I downloaded the latest trial version (Q2 2016) and used the 4.5 dlls on a brand new out of the box Visual Studio 2013 Webforms project. When setting the selected colour in the code behind I still have to click the "No Color" Button to change the colour - which is very irritating for the user as for them it looks nothing is happening (until they reset via No Color).

Here is what I did on the empty aspx page

    <telerik:RadColorPicker ID="ColourRadColorPicker" runat="server"
                            PaletteModes="HSB">
    </telerik:RadColorPicker>

then in the code behind page load

            if (!Page.IsPostBack)
            {
                ColourRadColorPicker.SelectedColor = Color.White;
            }

and you will see the color doesn't change in the color preview unless I click the "No Color" button...

Many Thanks in advance

Cheers

Pat

0
Marin Bratanov
Telerik team
answered on 12 Aug 2016, 08:00 AM

Hi Pat,

Thank you for the additional information.

In this case, you get the expected behavior, because you start from White.

In the hue-brightness-saturation color space, this results in 100 (i.e., max) brightness. Thus, no matter what RGB color you start from, the color will always be white, because it is always so bright to become white.

If you start from Black, you will get the same behavior, you will always stay at 0 brightness (i.e., complete blackness) and it will not matter whether the color that is so black as to become red is supposed to be red, yellow, green or any other color.

Clicking on No Color changes the brightness value, so you can start changing RGB colors as a side effect.

Regards,

Marin Bratanov
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
Pat
Top achievements
Rank 1
answered on 12 Aug 2016, 09:12 AM

Hi Marin,

No offence, I must admit I can follow your explanation - but to clients this looks like nothing is happening, even though it makes logically sense what you are saying.

Is there a way that we can change the "No Color" Button label to a button that says "Reset Colour" or so instead of an image that is shown?

Kind Regards

Pat

0
Marin Bratanov
Telerik team
answered on 12 Aug 2016, 09:29 AM

Hello Pat,

You can localize the tooltip of the button and/or you can use some JavaScript to change the button. Here is an example of both:

<telerik:RadColorPicker ID="ColourRadColorPicker" runat="server"
    PaletteModes="HSB" RenderMode="Lightweight" Localization-NoColorText="the tooltip for the no color button" OnClientLoad="OnClientLoad">
</telerik:RadColorPicker>
<script>
    function OnClientLoad(sender, args) {
        $telerik.$(".rcpImageButton.rcpEmptyColor", sender.get_element()).html("some text").css("width", "100px");
    }
</script>

You can use the CSS selectors to hide the ::before element that holds the icon. For example:

.rcpImageButton.rcpEmptyColor:before
{
    display:none;
}

where you can cascade that through a custom CssClass you can set to this concrete color picker.

Regards,

Marin Bratanov
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
Pat
Top achievements
Rank 1
answered on 12 Aug 2016, 12:23 PM

Hi Marin,

awesome - you guys rock!! - I put it in already!

Many Thanks

Pat

Tags
ColorPicker
Asked by
Marc Johnston
Top achievements
Rank 1
Answers by
Tsvetie
Telerik team
Pat
Top achievements
Rank 1
Marin Bratanov
Telerik team
Share this question
or