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

Tab order: jumping between panels is impossible?

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

1 Reply

AD Administrator Syncfusion Team October 4, 2002 05:22 AM

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; 
}

Loader.
Live Chat Icon For mobile
Up arrow icon