Apply button in HSV and HSB modes

9 posts, 0 answers
  1. Marc Johnston
    Marc Johnston avatar
    1 posts
    Member since:
    Nov 2009

    Posted 26 May 2010 Link to this post

    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. 
  2. Tsvetie
    Admin
    Tsvetie avatar
    1517 posts

    Posted 31 May 2010 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Pat
    Pat avatar
    4 posts
    Member since:
    Aug 2016

    Posted 05 Aug in reply to Tsvetie Link to this post

    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

  5. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3596 posts

    Posted 09 Aug Link to this post

    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.
  6. Pat
    Pat avatar
    4 posts
    Member since:
    Aug 2016

    Posted 11 Aug in reply to Marin Bratanov Link to this post

    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

  7. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3596 posts

    Posted 12 Aug Link to this post

    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.
  8. Pat
    Pat avatar
    4 posts
    Member since:
    Aug 2016

    Posted 12 Aug in reply to Marin Bratanov Link to this post

    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

  9. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3596 posts

    Posted 12 Aug Link to this post

    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.
  10. Pat
    Pat avatar
    4 posts
    Member since:
    Aug 2016

    Posted 12 Aug in reply to Marin Bratanov Link to this post

    Hi Marin,

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

    Many Thanks

    Pat

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017