Inform user why an element is disabled on mouse hover

2 posts, 1 answers
  1. Mihajlo
    Mihajlo avatar
    38 posts
    Member since:
    Aug 2018

    Posted 28 Aug 2018 Link to this post

    In my ribbon bar I can disable some elements on various occasions, and I would like to inform the user about the reason an element is disabled. Usually I would use a tooltip (and some extra code to enable tooltips even for disabled WinForms Controls). But ribbon bar elements are not WinForms controls, and also I don't know how to find a ribbon bar element at cursor's location. Do you have an idea how to inform the user about why the element is disabled when the user hovers the mouse over it?
  2. Answer
    Dimitar
    Admin
    Dimitar avatar
    2823 posts

    Posted 29 Aug 2018 Link to this post

    Hello Mihajlo,

    It is possible to show a custom tooltip when hovering over a disabled button. Here is an example that shows this:
    RadToolTip toolTip = new RadToolTip();
    RadButtonElement prevElement = null;
    private void RadRibbonBar1_MouseMove(object sender, MouseEventArgs e)
    {
        var element = radRibbonBar1.ElementTree.GetElementAtPoint(e.Location) as RadButtonElement;
        if (e.Button == MouseButtons.None && element != null && !element.Enabled)
        {
            if (prevElement != element)
            {
                toolTip.Show("Disabled because...", Cursor.Position, 2000);
            }
            prevElement = element;
        }          
    }

    I hope this will be useful. Let me know if you have additional questions.

    Regards,
    Dimitar
    Progress Telerik
    Get quickly onboard and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top