BUG: Grid Control Does Not Change Focus Until the Second Focus Event

ID: Q215390


The information in this article applies to:
  • Microsoft Windows CE Toolkit for Visual Basic 6.0, version 1.0


SYMPTOMS

A project contains the Grid control and one or more of the following controls:

  • CommandButton
  • ListView
  • PictureBox
  • TabStrip
  • TreeView
When you change the focus from the Grid control to any of the previous controls, the focus might not change until you click the other control twice. This behavior occurs in the emulation and device modes of the Palm-size PC, Handheld PC, and Handheld PC/Pro. The expected behavior is that the focus changes after the first click to the new control.


RESOLUTION

This behavior tends to occur when other screen-related events are involved, such as when you use the message box in the code example below. If other screen-related events do not occur, the focus events should occur as expected.


STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.


MORE INFORMATION

This section shows how to create a sample project that demonstrates this behavior.

Steps to Reproduce Behavior

  1. Start a new Windows CE HPC Pro, HPC, or PsPC Project in Visual Basic. Form1 is created by default. Set the appropriate project property to emulation mode.


  2. Add the following controls to Form1:


    • CommandButton
    • Grid
    • ListView
    • PictureBox
    • TabStrip
    • TreeView

  3. Copy the following code to the Form1 code window:


  4. 
    Option Explicit
    
    Private Sub Command1_GotFocus()
        MsgBox "Command"
    End Sub
    
    Private Sub GridCtrl1_GotFocus()
        MsgBox "Grid"
    End Sub
    
    Private Sub ListViewCtrl1_GotFocus()
        MsgBox "ListView"
    End Sub
    
    Private Sub PictureBox1_GotFocus()
        MsgBox "PictureBox"
    End Sub
    
    Private Sub TabStrip1_GotFocus()
        MsgBox "TabStrip"
    End Sub
    
    Private Sub TreeViewCtl1_GotFocus()
        MsgBox "TreeView"
    End Sub
     
  5. Press the F5 key to run the project. Set the focus by clicking the grid control. A message box appears to confirm that the GotFocus event executed. Click OK to close the message box. Click on another control.

    BUG: The GotFocus event for that control does not execute until you click the control for the second time. The expected behavior is that the GotFocus event executes on the first click.


  6. NOTE: If the code above is modified to avoid other screen activities, the focus events should occur as expected. For instance, add a Listbox to the form and change the instances of "MsgBox" to "List1.AddItem" (without the quotes). The focus changes should occur as expected and be correctly reflected in the Listbox.


REFERENCES

Microsoft Windows CE Toolkit for Visual Basic 6.0

Additional query words: VBCE WINCE HPC Pro PsPC vbce6

Keywords : kbListView kbTabCtrl kbToolkit kbTreeView kbVBp600bug kbWinCE kbGrpVB
Version : WINDOWS:1.0
Platform : WINDOWS
Issue type : kbbug


Last Reviewed: September 1, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.