BUG: MenuClick Event for MenuBar Control Does Not Fire Correctly in eVB (262029)



The information in this article applies to:

  • Microsoft eMbedded Visual Basic 3.0

This article was previously published under Q262029

SYMPTOMS

When you click a top-level menu item, the MenuClick event of the MenuBar control does not fire correctly.

CAUSE

eMbedded Visual Basic (eVB) does not support firing events on top-level menus for the MenuBar control.

RESOLUTION

To work around this problem, use a button with a caption on the MenuBar or CommandBar instead of a top-level menu item. You can then process the Click event of the button.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Create a PocketPC project in eVB. Form1 is created by default.
  2. In the Project/Component dialog box, select the PocketPC MenuBar Control 3.0 check box to add it to the toolbox.
  3. Add an instance of the control to Form1.
  4. Paste the following code into Form1:
    Private Sub Form_Activate()
        Dim menuA As MenuBarMenu
        Set menuA = MenuBar1.Controls.AddMenu("Menu1")
    End Sub
    
    Private Sub MenuBar1_MenuClick(ByVal Item As MenuBarLib.Item)
        MsgBox  "Menu item is clicked"
    End Sub
    					
  5. Press the F5 key to run the application, and click Menu1 from the MenuBar control. Notice that no message box appears.

REFERENCES

This behavior is documented in the eMbedded Visual Basic Help, under the topic "MenuBar Control," as follows:

Events cannot be fired from top-level menu items (i.e., menu titles). Use a
button to trigger events which are not menu items.
					


Modification Type:MajorLast Reviewed:9/4/2002
Keywords:kbbug kbDSupport KB262029