Tab Order NIghtmare

I cant get basic tab order to work in a desktop app im working on. It sgot the usual 6 or 7 textfields a DateTime picker, 3 non default buttons at the bottom right and a few other controls. I have set the taborder via the IDE button and arranged them how I want the order to go - basically left to right, top to bottom. Then, in the open event of the window, I have a ‘textfield.SetFocus’ on the field I want it to start at but it doesnt do that. I’ve tried all sorts of things to get it to start the application with the focus where i want it but to no success. I must be missing something simple? If I hit Tab, it goes to 1, 2, and then for a split second to 3 but then jumps all the way to 35 which is one of the buttons that is also set to no tab stop in the inspector and is at the bottom of the tabOrder dialog list…anyone know what Im doing wronf for such a simple thing?

Can you provide a sample project?
What Xojo version?
What OS?

2023r4, Im on a MacOS13.2. I dont see how this would be application specific so i dont have a sample project its part of a large project

I’m sorry, I can’t reproduce your problem.

Added several controls, used the button to order the Tab stops:

all working correctly. Moved buttons around, disable tab stop in one, added TextField5.setfocus on the Window opening event, all working correctly.

Do you have duplicate ‘Tab Index’ or can you check if the sequence is what you expect?

If you want Xojo to take a look, create a private Issue and upload your project.

Ive set the order via the dialog and that auto button but neither work, Ive set and triple checked the tab index and Allow stop and it just doesnt work. It basically bounces between the 1st, 2nd text fields and then to button 35th in line and back to 1. text fields 3 and 4 in the tab index are clearly marked but just get skipped.

Your desktop app is new or you started it with older version of Xojo?
Sorry I’m out of ideas.

thanks for trying! I think I started it in this version but maybe the previous. Its so frustrating! Ive deleted and recreated the text fields and it does the same thing. the second txt (index 1) gets focus for a split second and then it goes off somewhere and nothing has focus, then if i click tab again it goes back to index 0 so it just loops like that - when the button is not visible. if I set the button visible, it hangs and goes back to index 0 there. Then I deleted the buttons and its now closer to what it should be; it goes from index0-4 properly then goes ‘away’ again at 5 which is jusyt another text field…aaaaaarrrrghh

Use the button with the square and number 1. There you can order the fields the way you want it.

Thanks Paul, Ive tried that 15-20 times re arranging them to no end and it doesnt work

Do you do any focus shifting in code? In the past, sometimes people have forgot they’ve designed their own tab order in code, which tends to behave really weird when mixed with the framework tab order system.

As an example, you do not need to set the focus to the first text field in Window.Opening. When the Tab Order system is working correctly, the first control that can receive focus in the order will automatically have focus when the window opens.

I guess Sean wants to start with a different control that the first one (for some reason). I did my test setting the order, moving controls around and setting the focus on the 5th control and it works correctly (the 5th has Focus and I can Tab forward/back from that). I guessed (wrong) that maybe setting this focus will break things up but in my sample it worked correctly.

@Sean_Arney I feel your pain. Frankly IMHO tab ordering can get in a state where it’s completely FUBAR’d within Xojo. :frowning: I already have a couple tickets opened on this…

  1. 74145 - Tab Order Can Become Broken in Container Controls
  2. 74802 - Double Tab Required To Tab To Next Control

In half a year, I haven’t gotten any traction by the Xojo devs for a fix, but maybe if there are some other :+1: on these tickets, they might get a bit more attention.

As Tim has alluded to for a fix, in many instances I’ve resorted to hard coding in a tab order in a control’s KeyDown event…

If Key = Chr(9) And Not Keyboard.AsyncShiftKey Then // Tab
  Return True
End If

It’s been awhile, but I vaguely remember having to do this back in the day in REALbasic (or was is during the Real Studio era?). I can’t really say if this is a new set of bugs under Xojo or something that goes back a couple of decades now.


You can too, even if it is your own ticket.

1 Like

I was just about to say that you learn something new everyday, but alas it doesn’t seem to work for me…


Weird, I just clicked the thumbs up on my case: #76128
and no problems.

I have seen many Issues with thumbs up from the OP, not sure what is wrong here.

1 Like

Thanks Tim, I did remove my “setFocus” call in the window open as the first thing I fugured what youre describing miught be happening. That didnt help.

No Alberto, I do not want to start with a different control - wrong assumption. Even if I did what would be the harm or foul in that?

Thank you Patrick. I would agree that its not good. Fortunately, I have the assistance of @jim_mckay and he was able to help me get it sorted out. Im not sure what all he did but it does also involve a DAtePicker form Graffiti that does NOPt like getting focus and that may be what was throwing some of this off. Regardless of cause, I am fairly miffed that one cant use the TabOrder Editor, the Tab Index field in the inspector or at least a combination of those to exclude and order the tab order successfully with somewhat run of the mill controls. I spent sevral hours today wrestling with tab order - something that is horribly noticable to any user of any system. Whats worse, I seem to remember a dead end on this in a recent Web App project that had no fix at all…

Thanks for taking an interest. I appreciate the help. I will give these a vote

Glad to hear you got things worked out. I agree, @jim_mckay is top notch and is able to come through with some miracles when needed. But @Anthony_G_Cyphers is also just as awesome so if something is up with the DatePicker from Graffiti, I’m sure he’d appreciate a ticket if only to investigate.