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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Tab order: jumping between panels is impossible?

Thread ID:

Created:

Updated:

Platform:

Replies:

1215 Oct 4,2002 05:58 AM UTC Oct 4,2002 09:22 AM UTC WinForms 1
loading
Tags: FAQ
Mikael Ericsson
Asked On October 4, 2002 05:58 AM UTC

Is it possible to define a tab order _regardless_ of the z-order of controls? Example: We have a form in which there are, say, two panels P1 and P2 (both with the form as parent). P1 holds two text boxes A1, A2. P2 holds two text boxes A3, A4. We want to be able to define the tab order: A1, A3, A2, A4. To the point - we want to be able to define the tab order of controls without having to stay within containers such as panels - which we use for layout purposes primarily. (A GroupBox is another thing - and should be kept in the tab chain.) A "flat" view of the controls in a form - so to say. This seems to be impossible using the built in tab order tool, since containers (the panels) are always included in the tab chain. Anybody got some ideas on how to achieve our goal? Regards, Mikael

Administrator [Syncfusion]
Replied On October 4, 2002 09:22 AM UTC

You can override the Form's ProcessTabKey method and check the active control, and explicitly set the focus where you want it.
protected override bool ProcessTabKey(bool forward)
{
	if (this.ActiveControl.Equals(this.textBox1))
	{
		if(forward)
			this.textBox3.Focus();
		else
			this.textBox4.Focus();
	}
	else if (this.ActiveControl.Equals(this.textBox2))
	{
		if(forward)
			this.textBox4.Focus();
		else
			this.textBox3.Focus();
	}
	else if (this.ActiveControl.Equals(this.textBox3))
	{
		if(forward)
			this.textBox2.Focus();
		else
			this.textBox1.Focus();
	}
	else if (this.ActiveControl.Equals(this.textBox4))
	{
		if(forward)
			this.textBox1.Focus();
		else
			this.textBox2.Focus();
	}
	else
		base.ProcessTabKey(forward);
	return 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.

Warning Icon 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.Close Icon

;