Microsoft KB Archive/145677

= FIX: ARROW and TAB keys Stop Working in MDI Child Form =

Article ID: 145677

Article Last Modified on 1/8/2003

-

APPLIES TO


 * Microsoft Visual Basic 4.0 16-bit Enterprise Edition

-



This article was previously published under Q145677



SYMPTOMS
When you have an MDI parent form with a toolbar and one MDI child form, pressing a toolbar button can prevent the arrow keys and tab key from functioning as cursor navigation keys on the MDI child form. You can still type text into the text boxes on the child form, but the cursor can be moved only by using the mouse pointer.



CAUSE
The toolbar control is capturing all navigation key events, preventing the text box controls on the MDI child form from processing them.



RESOLUTION
To work around this problem, force the toolbar to lose focus. This will prevent the toolbar from trapping the navigation key events. Add the following code to the MouseUp event of the toolbar control: Private Sub Toolbar1_MouseUp(Button As Integer, Shift As Integer, _  x As Single, y As Single)

Me.SetFocus

End Sub



STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This bug has been fixed in Visual Basic 5.0 and 6.0.



Steps to Reproduce
 Start a new project in Visual Basic. Form1 is created by default. Place two text boxes on form1. Press F4 to bring up Visual Basic's property page and set form1's MDIChild property to true. Add a MDI parent form to your project, by selecting "MDI Form" from the "Insert" menu. Add a Toolbar control to your MDI form.</li>  Add the following code to the MDIForm_Load event of the MDI Form: Private Sub MDIForm_Load

Toolbar1.Buttons.Add Form1.Show

End Sub </li> Press the F5 key or click Start on the Run menu to start the program.</li> Click the toolbar button.</li> Click a text box, to give it keyboard focus. Now try using the cursor or tab keys to reposition the cursor.</li></ol>

Additional query words: kbVBp400bug kbVBp500fix kbVBp600fix kbVBp kbdsd kbDSupport kbMDI kbControl

Keywords: kbbug kbfix KB145677

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.