C# – Tabbing to invisible control in WinForms

ckeyboardwinforms

I have a note editor control in my Windows Forms application:

alt text http://img82.imageshack.us/img82/2033/tabtohiddencontrol.png

I want to make this control accessible through the keyboard: I want to be able to TAB to it, TAB through the controls, and TAB out of it.

Normally this is an easy task, however, the issue is the hidden subject textbox. By design, the subject is editable only when the user clicks on the subject label.

When my control receives focus, I want to start editing the subject; make the subject text box visible and focused.

WinForms doesn't like this; my subject text box is hidden, and so WinForms skips over it when tabbing in and out of my control. How can I make this work?

Best Answer

You will have to add code in previous code's lostfocus (or keypress to check for TAB). And, you will have to add code in next control (after the label textbox) to check for Shift+TAB.

You could also add a label before Subject with mnemonic, so user can press ALT+S to reach there.

This is what I could think of right away.
Correct me, if I have not understood your question.

Related Topic