We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

text select bug and semi-related question

If I have text in a cell that has a worf eding in a single quote like: auditors'' in the middle of a sentence, when I double click on that word it does not select the word; it selects the quote and the space after it. My related question - how can I deselect all text when the cell first gets focus? I have tried using the GridAwareTextBox.Select(0,0) after wiring it to the grid on all manner of events and not having any luck. The issue is that when a user first sets focus (often by clicking on expand or collapse) it selects all text by default, so if the user presses any key it wipes it all out.

2 Replies

AD Administrator Syncfusion Team February 8, 2004 01:40 PM UTC

How the currentcell handles the text when it becomes active normally is controlled by the ActivateCurrentCellBehavior property of the grid. If you are seeing it normally selectall, then I suspect this property has been explicitly set to GridCellActivateAction.SelectAll. There are some exceptions (like CurrencyEdit celltypes). The behavior I see is double-clicking on the quote or the space selects the quote+space, but double-clicking on any letter in author, selects author. It does this because that is the default behavior of the System.Windows.Forms.RichTextBox on which our "TextBox" celltype is based. If you want the behavior of System.Windows.Forms.TextBox (which will select author when you click on the quote or the space), then you can change the celltype to "OriginalTextBox" which is based on the Windows Forms TextBox. Another option that lets you customize what a double click does is to handle this event and explcitly select what you want selected. private void gridDataBoundGrid1_CurrentCellControlDoubleClick(object sender, System.Windows.Forms.ControlEventArgs e) { GridTextBoxControl tb = e.Control as GridTextBoxControl; if(tb != null) { //select whatever you want tb.SelectAll(); } }

AB Andy Barnhart February 8, 2004 04:25 PM UTC

It wasn''t set to SelectAll; it was set to ClickOnCell. But trying the valuse there, it turned out that "SetCurrent" does what I want. Thanks. On the other matter, I don''t think you understand what I was "saying". If the word auditors'' (with a signle quote at the end) is in the text and I double click on the letter u (or pretty much anywhere_, it selects the quote and the space after it only, not the letters in the word. It''s a very minor bug, but I wanted to report it rather than ignore it. BTW, my evaluation of your product is going better than it may seem. I pick nits and no one gets a perfect score. Getting support on a Sunday was unexpected and a big positive.

Live Chat Icon For mobile
Up arrow icon