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

ActiveCell scrolls always into view when on form with AutoScroll enabled

Hi, I''m using 3.0.1.0 Suite and I have the following problem: I have the grid control on a form that has AutoScroll enabled. In the upper area of the form I have some dropdowns which specify the grid''s content. Now, when a cell is active and I resize the form the active cell is always scrolled into view automatically. Can I prevent this behaviour and keep the upper area visible unless I use the scrollbars of the form to scroll to the grid cell manually? Thanks in advance, Chris

5 Replies

AD Administrator Syncfusion Team June 30, 2005 04:15 AM

This is likely a WIndows Forms behavior. You can test this by creating a project with a scrollable form and adding a TextBox to the bottom of the form. Then run the project and size the form. You will see the scrollbar adjust so that the active textbox is always visible. I do not know of a nice clean way to avoid this behavior. You can hack by doing something like put a 1x1 button at the top of your form. Then handle form.Resize and call buttun1.Focus() in the handler. This is move teh focus away from teh active control and noot require the window to scroll.


CR Christian Rattat June 30, 2005 05:22 AM

Thanks Clay, I should have noticed myself that this comes from the form and not from the grid. Regards, Chris


CR Christian Rattat June 30, 2005 06:29 AM

Hi, it seems there is another reason for the problem. I tried your solution in a sample and it works. But in my actual application I have an mdi form which uses the SyncFusion tabbed mdi manager. The form that holds the grid is an mdi child. Now, when I set the focus to the test button the focus remains on the grid. Even if I do a currentcell.deactivate and then set the focus to the button or the form (or anything else) it remains on the grid. I have attached a sample that shows the behaviour. Regards, Christian FocusTest_2.zip


AD Administrator Syncfusion Team June 30, 2005 07:15 AM

In your SizedChanged handler, try setting the form''s ActiveControl to be the button.
private void Form1_SizeChanged(object sender, System.EventArgs e)
{
	this.ActiveControl = this.button1;
	//this.button1.Focus();
}


CR Christian Rattat June 30, 2005 10:30 AM

Great! This works perfect for me. Thanks, Chris

Loader.
Live Chat Icon For mobile
Up arrow icon