Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
405
Selecting all contens in cell when clicking
posted

Hi,
I would like the following functionality in my WinGrid:

When a user clicks in an editable cell for the first time, all text in the cell is selected.
If he clicks again in the cell, the selection is removed and the insertion point is where he
clicked.

I.e. the same behaviour as in the "URL textbox" in Internet explorer.

I haven't been able to find out how to do this... has anyone else?

Regards
Tomas. 

 

 

Parents
  • 469350
    Verified Answer
    Offline posted

    Hi Tomas,

        Try something like this: 

            private void ultraGrid1_AfterEnterEditMode(object sender, EventArgs e)
            {
                UltraGrid grid = sender as UltraGrid;
                if (grid.ActiveCell != null)
                {
                    EmbeddableEditorBase editor = grid.ActiveCell.EditorResolved;
                    if (editor.SupportsSelectableText)
                    {
                        editor.SelectAll();
                    }
                }
            }

Reply Children
No Data