Force focus to start in first (0 ID) control

I was certain I had read that by setting the ID to 0 and enabling tab stop that focus would begin in that particular field. But for some of my containers on a page panel the focus starts OUTSIDE of the desired first text field (but not in any identifiable control).

I’ve set up all the desired fields that I wish to tab between to have consecutive IDs, and to have their Tab Stop pref enabled. When I press an initial tab, it DOES immediately move into that first field. And my setting of the entire tab order is exactly correct: I can tab through all the fields and only those desired fields have focus.

So is there something else I should be doing to force my desired text field to start with focus?

I guess your problem is when you change to a new page panel there is no TextField with Focus, right?

When you change the page panel you can use TextFieldX.SetFocus or ContainerX.TextFieldX.SetFocus to force the focus to the TextField you want (change the names to the names you are using).

1 Like

Thanks, that worked!

I wonder if it is a defect that focus doesn’t move to the 0th ID on its own?

I always have this trouble;

For example a ListBox and a TextField:
The ListBox ID is 0
The TextField ID is 1 (or 10)

When I paste text into theListBox it always falls into the TextField. I have to issue a Tab to set the Focus to the ListBox. (since far before Xojo 2015r1…)

You paste text into a TEXT FIELD in the ListBox, or the ListBox, when it has focus, knows how to accept a paste operation, but the ListBox just doesn’t initially have focus?