ACC: ShortcutMenuBar Property Does Not Work on Image or LabelLast reviewed: April 3, 1997Article ID: Q166293 |
The information in this article applies to:
SYMPTOMSModerate: Requires basic macro, coding, and interoperability skills. When you set the ShortcutMenuBar property of an image control or label control on a form to the name of a custom shortcut menu, right-clicking the control causes the default shortcut menu for the form to appear.
CAUSEThe ShortcutMenuBar property does not work with controls that cannot receive the focus.
RESOLUTIONUse one of the following methods to work around this behavior, depending on your version of Microsoft Access.
Method 1: Microsoft Access 7.0 and 97Place an invisible command button on the form and use it to invoke your custom shortcut menu:
Method 2 (Microsoft Access 97)You can use the MouseDown event of the image or label control to invoke the ShowPopup method of your custom shortcut menu. In order to use this method, your custom menu must have its Type property set to PopUp, which is a requirement for any shortcut menu. This example assumes that you are familiar with Visual Basic for Applications and with creating Microsoft Access applications using the programming tools provided with Microsoft Access. For more information about Visual Basic for Applications, please refer to the "Building Applications with Microsoft Access 97" manual. Set the MouseDown event of the image or label control to the following event procedure. This example assumes a control named Image0, and a shortcut menu named Custom1; substitute the names of your own control and shortcut menu in the procedure.
Private Sub Image0_MouseDown(Button As Integer, Shift As Integer, _ X As Single, Y As Single) 'If the right mouse button is pressed, show the custom shortcut menu If Button = acRightButton Then CommandBars![Custom1].ShowPopup End If 'Cancel the event so the form's default shortcut menu does not appear DoCmd.CancelEvent End Sub STATUSThis behavior is by design.
REFERENCESFor more information about using shortcut menus in Microsoft Access, search the Help Index for "shortcut menus," or ask the Microsoft Access 97 Office Assistant. For more information about the ShortcutMenuBar property, search the Help Index for "ShortcutMenuBar property."
|
Additional query words: short cut popup
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |