Does anyone know why Labels and Frames (and possibly other controls) have a TabIndex
property in VB6? Is there some use for it; some feature of GUI programming I ought to be incorporating in my applications (that I am blissfully unaware of)?
Why do labels and frame have a "Tab Index" property in VB6?
Asked Answered
To confirm what Cody said in the comments. The VB6 manual entry for TabIndex says:
Controls that can't receive the focus (Frame and Label controls) remain in the tab order but are skipped during tabbing.
but
If you press the access key for a Frame or Label control, the focus moves to the next control in the tab order that can receive the focus.
TabIndex
is the property used to determine the sequence of focused controls when user presses TAB key.
If control with TabIndex=5
is focused and user presses TAB, control with TabIndex=6
will take focus.
Well, yes, but Labels and Frames don't get focus (or do they under some circumstances?); that's the mystery. –
Moisesmoishe
@Brian Hooper: for what I remember about VB6, labels take focus, but you can tell them to move focus to another control (for example a TextBox or a ListView) –
Monitorial
Ah. Is that so? Thanks, I'll try some experiments. –
Moisesmoishe
@Brian: Labels and frames do not get focus. They pass the focus to the control immediately following them in the tab order. That's useful for setting focus to a textbox or combobox, for example, using an ALT+letter combination, since they don't have any text of their own to display a mnemonic. –
Nolen
Windows does this all over the place, and it's very important for accessibility with keyboard-only users. Check some of the control panels while holding down the ALT key to make the mnemonics appear. –
Nolen
@Cody Gray: thanks, it's a long time I don't use VB6 and my memory was faulty ;) –
Monitorial
@Marco: No problem. It's exactly the same deal in every other Windows GUI app, from straight Win32 API to VB 6 to .NET WinForms and beyond. Tab order is extremely important to get right. –
Nolen
@Cody Gray: yes, I know the problem of tab order, above all for people using only keyboard (I can use mouse, but I prefer using keyboard if I can, it's faster), but I forgot the fact about labels and frames. Anyway I'm quite sure (but I wait for your advice) that in VB6 you could set a focused control in a Label, overriding taborder... am I right? Thanks again Cody –
Monitorial
@Cody @marco Cody is right. I've postd an answer with some supporting quotes from the VB6 manual. –
Denigrate
@Cody @marco @Denigrate thank you for that. I think I see the point now; just a bit of work needed on my code... –
Moisesmoishe
© 2022 - 2024 — McMap. All rights reserved.