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
close icon

GridControl.MoveTo and Focus

Here is the problem: 1. I give grid the focus 2. then call this.grid.CurrentCell.MoveTo( 1, 2, GridSetCurrentCellOptions.SetFocus ); which makes the grid loose focus 3. User presses tab while in cell [1,2]. 4. In OnSaveChanges, I hide the usercontrol in cell [1,2]. 5. .Net sets the focus to "next" control after the grid, since the grid lost focus in step2. 6. Your MoveTo moves the currentcell to [1,3], however the user cannot type anything in cell [1,3] because the focus neither the grid or the currentcell have focus due to step 5. This is the problem. Bug? Things work fine if in OnSaveChanges, I do if (this.CurrentCell.IsInMoveTo) this.Grid.Focus();

3 Replies

AD Administrator Syncfusion Team December 14, 2005 11:04 PM UTC

Is the grid the parent of the UserControl in cell 2,1?


AD Administrator Syncfusion Team December 15, 2005 07:46 PM UTC

Yes.


AD Administrator Syncfusion Team December 15, 2005 08:01 PM UTC

Since this is a custom cell, I think you will have to handle it in some manner. I do not think this is something we can control in a general way. Here are some other ideas to try if you do not like the solution you can up with: 1) See if implementing this interface makes a difference bool IQueryFocusInside.QueryFocusInside() { if (ContainsFocus) return true; else { foreach (Control c in this.Controls) { IQueryFocusInside qfi = c as IQueryFocusInside; if (qfi != null) { if (qfi.QueryFocusInside()) return true; } } } return false; } 2) Don’t hide the user control in OnSaveChanges. Instead hide the user control by overriding the Hide() method. 3) make sure you did call SetControl. If you called SetControl then the GridCellRendererBase.Hide method normally already takes care of properly hiding the control with proper focus management and ideas 1 and 2 should not be needed. 4) Set the following properties on the UserControl: .TabStop = false and .CausesValidation = false

Loader.
Live Chat Icon For mobile
Up arrow icon