Disabling TAB

Hi All,
Another “hobbiest” question for the brains trust.

I have a window that displays editable pieces of infomation. Now, normally I would use text boxes to display and edit but, for aesthetics (and the excersise) I have done the following:
I use Labels to display the info. Then to edit, I have 1 “hidden” text box. When I click on a label, I make the text box visible, match the left, top and width attributes of the label and copy its text contents into the text box and set the focus.

All that works ok. I then use the keydown event to capture “special” keys. Eg if Esc is pressed, I make the text box invisible and leave everything as is. If Enter is pressed, same except I update the label text.

I also want to capture the if TAB & SHIFT/TAB are pressed to TAB through the labels. This appears simple, I keep track of the Label index and increment/decrement the number and reset the text box appropriately. Problem is, there appears to some some controls that “override” the TAB being acted upon. Eg., I have a radio group control. When I do the above, my text box moves correctly, but then the focus moves to the radio group. Is this an error or is there something I can do? I have set TabStop to off on all controls.

Also, does anyone know how to capture SHIFT/TAB. ASCII 9 is the TAB, but is returned regardless of whether the shift key is pressed to not.

(I hope that all makes sense :slight_smile: )
Thanks

In the KeyDown event of the text field, test Keyboard.ShiftKey to tell whether the shift key was pressed or not. Remember to return True from KeyDown so the system doesn’t try to process the TAB key on its own.

1 Like

AWESOME!! Fixed them both, Thanks :grinning:

Can I push the bounds of friendship and ask 1 more question (from a long list btw :slight_smile: ). Is there a way to change the font attributes - actual font, size, colour etc in controls like the datetime. It appears there are some controls that don’t have them as options.

Thanks again (especially for the 1st one!)

Happy to help. Not pushing any bounds, I just don’t happen to know the answer to your question. It might be best to start a new thread about it with a relevant title so you get better visibility about that particular question.

Cool, thanks Tim :grinning:

Barry