BUG: ARROW and TAB keys Stop Working in MDI Child Form

Last reviewed: October 8, 1996
Article ID: Q145677
The information in this article applies to:
  • Standard, Professional, and Enterprise Editions of Microsoft Visual Basic, 32-bit only, for Windows 4.0

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.

STATUS

Microsoft has confirmed this to be an issue in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

WORKAROUND

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

MORE INFORMATION

Steps to Reproduce

  1. Start a new project in Visual Basic. Form1 is created by default.

  2. Place two text boxes on form1.

  3. Press F4 to bring up Visual Basic's property page and set form1's MDIChild property to true.

  4. Add a MDI parent form to your project, by selecting "MDI Form" from the "Insert" menu.

  5. Add a Toolbar control to your MDI form.

  6. Add the following code to the MDIForm_Load event of the MDI Form:

       Private Sub MDIForm_Load()
    
           Toolbar1.Buttons.Add
           Form1.Show
    
       End Sub
    
    

  7. Press the F5 key or click Start on the Run menu to start the program.

  8. Click the toolbar button.

  9. Click a text box, to give it keyboard focus. Now try using the cursor or tab keys to reposition the cursor.


Additional reference words: 4.00 vb4win vb4all
KBCategory: kbusage kbbuglist
KBSubcategory: PrgCtrls


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: October 8, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.