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.
Unfortunately, activation email could not send to your email. Please try again.

Lose selected cell when RefreshRange

Thread ID:

Created:

Updated:

Platform:

Replies:

17009 Jul 28,2004 09:57 PM Jul 29,2004 01:30 AM Windows Forms 1
loading
Tags: GridControl
Dan
Asked On July 28, 2004 09:57 PM

Per a suggestion in the forum (http://www.syncfusion.com/support/Forums/message.aspx?MessageID=16469) I''m handling the CurrentCellMoved event, and calling RefreshRange() and then in QueryCellInfo setting colors to highlight the current row and column of the selected cell. I have set ActivateCurrentCellBehavior = GridCellActivateAction.SelectAll to select the text in a cell when the user moves into the cell. However, when calling RefreshRange() in the CurrentCellMoved event, I''m losing that selected text. What is the best way to get the selected text to remain after the RefreshRange() calls? I have poked around a bit, and realized that I could get at the RichTextBox control in the cell, then set the SelectedLength property. RichTextBox tb = grid1.CurrentCell.Renderer.Control as RichTextBox; if ( tb != null ) { int len = tb.Text.Length; tb.SelectionLength = len; } Any thoughts about this method, or any better ways to achieve this? (I do see a slight flicker in the selection doing it this way...text in the newly selected cell is selected, then not, then selected again) Thanks!!

Administrator [Syncfusion]
Replied On July 29, 2004 01:30 AM

You could try turning off the ActivateCurrentCellBehavior = SelectAll, and do the SelectAll yourself at the bottom of your CurrentCellMoved with the code below. Hopefully, this would avoid the flicker you mentioned. GridCurrentCell cc = this.gridControl1.CurrentCell; cc.BeginEdit(); GridTextBoxControl tb = cc.Renderer.Control as GridTextBoxControl; if(tb != null) tb.SelectAll();

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;