I have designed a data entry popup with a number of input components arranged in 2 columns. When I try to tab between these, the order the components are highlighted in always goes from left to right, then from top to bottom.
It would be very nice to be able to set the tab order of input components, like Visual Basic.
After a bit more playing about I’ve managed to get it working the way I want by putting the 2 columns into separate containers. Using tab will go through all the components in one container before moving onto the next container. The containers themselves will still be processed in the left to right then top to bottom order.
I think this should enable all but the weirdest layouts - I don’t know whether anyone else things a totally customizable tab order would still be useful?
While a customizable tab order wouldn’t be a bad thing, I personally hate the way Visual Basic does it. Their ‘tab order’ ( at least back in the day when I used VB) was an integer that was initialized based on the order that you had dropped the components on the screen, which meant that the tab order was always wrong and bizarre. Also, whenever you rearrange a screen, the tab order would get screwed up, forcing a tedious re-ordering task.
FactoryPMI intuits the tab order based on right-to-left top-to-bottom positioning of the components. This might not be perfect, but we’d have to think of a better way than VB’s method before we were to change it…
Anyhow, glad you got it working by group the components together in containers.
Is there any way to enable/disable the container so the user can choose the order of the tab?
I want to do something like the sample entry that let you choose the order in what the tab moves
I put the Text Area component inside a separate container than the Root Container(Traced Border).
As the user Tabs through the Input Fields it still Tabs into the Operator Note Text Area when it lines up Left to Right. Can you explain your solution further? Thanks.
I think I figured it out. I created two Containers within the root container.
One holds all our Numeric and Text Inputs and the other holds the Operator Note Text Area.
Appears to be working. I’m still curious if there might be other ways to accomplish this same Tab order.
Your other option is to create a class that implements the Java
FocusTraversalPolicy interface and manually decides in what order components get focused. It would be very complicated and very fragile. Grouping is by far the easiest solution.