WinForms TabOrder tool: Broken or just confusing?
Asked Answered
L

5

4

I have a form with a bunch of panels, and some panels inside groupboxes. When using the TabOrder tool in Vs2005, the controls outside of containers are given integers (0), the controls inside panels are given decimals (72.0), and the controls within panels within groupboxes are given three-part values (73.73.0). Unfortunately the resulting tab order has nothing to do with the order I clicked my controls.

Does this tool simply not support nested containers? Am I doing something wrong? Perhaps holding Shift- or Ctrl- when I click (I've tried these with no success)?

Am I going to be forced to manually type in three-part tab orders for all my controls? That would be a bummer.

Lodicule answered 17/6, 2010 at 17:2 Comment(0)
R
7

The tab order tool is not designed for you to enter values manually; it is designed for you to click on controls in the order that you'd like them to progress as the user tabs.

The numbers are not decimals; they represent the tab order of the control within its parent container. For example, if you have a Form with a Panel named panel1 and a Button inside of it named button1, then button1 would display a number like:

X.Y
  • X is the tab order of panel1
  • Y is the tab order of button1 within panel1.

I will acknowledge that the designer isn't as intuitive (or transparent) as it probably should be, but it does work.

Racemic answered 17/6, 2010 at 17:4 Comment(0)
R
2

I had the same problem with textboxes and buttons within group box in VS2010. TabOrder tool was just useless: Tab orders were broken no matter how I re-ordered the tab stops. In order to make the correct tab order I had to re-order of how controls are added to the group box in form designer initialization code:

this.groupBox2.Controls.Add(this.startTimeTextBox);
this.groupBox2.Controls.Add(this.endTimeTextBox);
this.groupBox2.Controls.Add(this.exitButton);

This way tab order would be startTimeTextBox -> endTimeTextBox -> exitButton and so on.

Reiterate answered 10/4, 2013 at 11:59 Comment(1)
This worked for me. In VS2010, with View > Tab Order, the Control.TabIndex would be correct. However, regardless of how I numbered the controls, Form.Designer would have items in a different order, which seems to change the tab order.Iinde
L
0

I think I figured out the way to do it in the designer: the trick is apparently that you have to click the panels/groupboxes as well in order to assign the different parts of the full ordering; in this way, it seems that a bredth-first clicking method needs to be used as opposed to clicking the child controls themselves.

Kinda sad, since it forces you to know the full structure of the whole form instead of just what the user sees.

Lodicule answered 17/6, 2010 at 17:14 Comment(2)
If it makes you feel any better, the designer in 2008 does not have this issue.Racemic
I actually use 2010 now for most things, but this project is winforms & 2005, for maximum pain.Lodicule
O
0

I had this same problem and discovered this tool: http://archive.msdn.microsoft.com/cdstabindex

I had to change the manifest to make it work with VS2010 though. Also, I've modified the source code for myself to make the UI a little better, but even as it is, I would recommend having a look at this tool.

Objectionable answered 6/11, 2012 at 18:10 Comment(0)
V
0

Remove Group-boxes from Controls and try again this works for me :)

Vmail answered 12/10, 2015 at 6:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.