|
-
Jan 29th, 2006, 07:39 PM
#1
[RESOLVED] Do panels mess up Focus for other controls?
I have an odd situation. Unfortuantely I can't post my code, however I can explain exactly what I did.
At first I had a form with 1 label next to a text box at the top, a larger text box in the middle, and 2 buttons at the bottom (save and cancel). I had the first textbox's TabIndex set to 0, the middle TextBox's to 1, Save to 2, and cancel to 3.
This worked great and worked as expected.
Then I wanted to make it easily resizable. I took 2 panels. 1 Panel I placed the top label and text box onto it and set the Dock to Top. The second label I took and placed the 2 buttons onto it (save and cancel) and placed the panel at the bottom of the form with a Dock of Bottom. The center Textbox didn't work correctly with a Dock of Fill (it went under the panel controls) so I placed some simple code in the resize event of the form to manually resize it.
All works well except now the first item that has focus is the center textbox (which has a TabIndex of 1).
I don't understand why.
Both panels have have TabStop = False (and both have higher TabIndexes (5 and 6).
I have tried in the Form's onLoad event to set the TabIndex to the TextBoxes but I sitll get the same result.
I thought that, maybe because I modify the center textbox during the Resized event, that it automatically gets focused so I tried removing that part and coding around it so it remembered the last item with focus. That also didnt work.
This didn't happen until I put panels onto my form. Is this a known issue or am I missing something totally obvious?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|