TabOrder is not followed

On a desktop app (in my case, Mac M1 on Monterrey) is there something to getting the tab order to work other than using the Tab Order Editor to drag controls around? I have controls appearing in a particular order on the Tab Order Editor but at runtime the tab order appears to be random (or probably the order in which I created the controls). In fact the first control to receive focus is the one I have last in the tab order, but that’s probably a coincidence as it’s certainly not following reverse tab order. It is however the text control that I added last.

The particular controls I’m talking about happen to be on a tab control, if that matters. I have taken the initial approach of arranging a listbox, various textboxes and comboboxes in order, and leaving labels and buttons in indifferent order at the end of the list. I understand that on Mac OS, by default, combo boxes will not even get focus, but even the textboxes are not being traversed in order.

Anything I’m missing?

Hm … I have a more complex tab that includes most controls on 1 of 2 DesktopRectangles and the tab order I set works perfectly there, for whatever reason. Seems flaky. Must be some kind of trick to shaking it loose.

Textfields are stopped on by tab order.

To be clear, I only care about text fields. They are obeying tab order in one set of controls and not in another. If I’m not supposed to do something other than order them in the tab order dialog to get them to respond to tabbing around properly then something is broken either in the IDE or the framework. The trick will be figuring out what. Not a priority today, or even that big a deal for this particular app, but I’ll need to get to the bottom of it at some point.

In the IDE you can exclude any control from being part of the tab order.

Are you by any chance filtering input in the Keydown event ? That could inhibit the tab character.

No keydown events, no.

I think the problem is that the runtime is ignoring the set tab order for this set of controls. I was just fishing here for whether there’s some thing that is needed apart from setting that order but it’s working on a different set of controls perfectly so … it may be that support will have to look at my project to figure out what’s happening if I can’t get to the bottom of it.

Are you embedding controls at runtime? These end up in the tab order in a surprising way (I think it was backwards, it’s honestly been years since). Or are you experiencing a problem with exclusively a designer made order? Can you reproduce the problem in a sample project?

Strictly a designer-made order, I’m not adding any controls programmatically.

I can pare this project down when I have time and try to repro it. Might be a bit. In the meantime I am hoping to stumble on the answer.

This and another issue I haven’t discussed yet are lower priority on an in-house app like this, but would be more concerning if it were an app I was selling or maintaining for someone.

It should be noted that if this problem were in the frameworks, more people would be running into it. I’m certainly not in my apps.

2 Likes

Can you create a simple project to demonstrate the trouble ?

Place the Controls in a strange way (first, one from the middle, the last, another from the middle…), then re-order them with the MenuItem Option and share the whole if it does not work as modified.

Does it “kinda” work for most controls, and only a few don’t comply to tab order, or is the issue with all controls ?

It is with all controls on that particular tab of a DesktopTabControl. On other tabs, things are fine.

My money would be on the IDE, but IDK how the tab order dialog would show the correct order and yet this would not be picked up by the compiler.

I’m sure it’s an edge case or, as you say, others would be reporting it. It’s even only a problem for me on one set of controls. That is why I doubt creating some trivial example project would demonstrate the problem. It’s got something to do with the particular combination of things in this app, I’m sure.

My immediate objective was to make sure there wasn’t some step I was missing or a common gotcha I didn’t know about.

I am dubious this will repro in a trivial project or it would have already been reported. I’ll circle back to this when I’m done creating this app, if it still persists. I’m also saving a copy of the project as it is today, for comparison.

Perhaps if you delete all the controls in that tab, and start over, the issue will go away.

Yeah that occurred to me but we are talking a couple dozen controls plus labels and I have a lot of code in there already and everything positioned so it’s not quite that trivial. And I am not that patient, lol. Too irascible in my dotage.

I also note that you can’t cut a control, switch to a different tab, and paste it there. The IDE reverts to the tab you were just on when you paste. A few little WTF “features” like that is a little bit of an eyebrow-raiser in an IDE that’s had a whole generation to mature. Nothing deal-breaking, but come ON.

I will circle back to this tab order thing in the fullness of time, probably in about a month when I’m finished implementing and in the fine-tuning phase.

The workaround is to handle tab by yourself in Keydown. Chr(9) to go on, chr(8) to go back. It maybe less tedious than rebuilding everything.

Yeah that is the hack-y fix in extremis. And not all that odious.