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

Tooltip on a cell in edit mode

1 Answer 10 Views
This is a migrated thread and some comments may be shown as answers.
Dreyfus
Top achievements
Rank 1
Veteran
Dreyfus asked on 23 Jun 2020, 02:09 AM
Is there a way to show a tooltip on a cell in edit mode?

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 23 Jun 2020, 01:45 PM
Hello, Jay,  

RadGridView offers a convenient way for showing tool tips for the cell elements when they are not being edited: https://docs.telerik.com/devtools/winforms/controls/gridview/cells/tooltips 

Once an editor is activated, it handles the keyboard and mouse input. That is why the cell's tooltip is not shown. 

The following code snippet demonstrates a sample approach how to show a tool tip when a RadTextBoxEditor is initialized. The attached gif file illustrates the achieved result. Note that this is just a sample approach and it may not cover all possible cases. Feel free to modify and extend it for the other editor types in order to achieved the desired custom behavior.
        RadToolTip toolTip;

        public RadForm1()
        {
            InitializeComponent();
             
            this.radGridView1.CellEditorInitialized += radGridView1_CellEditorInitialized;
            this.radGridView1.CellEndEdit += radGridView1_CellEndEdit;
        }

        private void radGridView1_CellEndEdit(object sender, GridViewCellEventArgs e)
        {
            toolTip.Hide();
        }

        private void radGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e)
        {
            RadTextBoxEditor tbEditor = e.ActiveEditor as RadTextBoxEditor;
            if (tbEditor != null)
            {
                if (toolTip == null)
                {
                    toolTip = new RadToolTip();
                    toolTip.InitialDelay = 0;
                }

                RadTextBoxEditorElement elementUnderMouse = tbEditor.EditorElement as RadTextBoxEditorElement;
                if (elementUnderMouse != null)
                {
                    toolTip.Show(elementUnderMouse.Text, Cursor.Position);
                }
            }
        }

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Asked by
Dreyfus
Top achievements
Rank 1
Veteran
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or