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.

GridControl.MoveTo and Focus

Thread ID:

Created:

Updated:

Platform:

Replies:

38549 Dec 14,2005 04:24 PM Dec 15,2005 03:01 PM Windows Forms 3
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On December 14, 2005 04:24 PM

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();

Administrator [Syncfusion]
Replied On December 14, 2005 06:04 PM

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

Administrator [Syncfusion]
Replied On December 15, 2005 02:46 PM

Yes.

Administrator [Syncfusion]
Replied On December 15, 2005 03:01 PM

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

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.

;