PRB: Hot Keys of a ToolBar ActiveX Control are not Active (249700)
The information in this article applies to:
- Microsoft Visual FoxPro for Windows 3.0
- Microsoft Visual FoxPro for Windows 3.0b
- Microsoft Visual FoxPro for Windows 5.0
- Microsoft Visual FoxPro for Windows 5.0a
- Microsoft Visual FoxPro for Windows 6.0
This article was previously published under Q249700 SYMPTOMS
Hot keys for buttons defined on a ToolBar control, from the Microsoft Common Controls ActiveX control (mscomctl.ocx), that are used in a Visual FoxPro form are not active when the form is executed.
CAUSE
The ToolBar ActiveX control does not have SetFocus, GotFocus, or LostFocus events and thus cannot receive focus. Since the ToolBar ActiveX control cannot receive focus, pressing the ALT key plus the underlined character of the ToolBar button(s) has no effect.
RESOLUTION
There are two ways you can work around this issue.
- Issue an ON KEY LABEL command similar to the following code snippet:
ON KEY LABEL ALT+A _SCREEN.ACTIVEFORM.buttonclick(_SCREEN.ACTIVEFORM.BUTTONS(1))
ON KEY LABEL ALT+B _SCREEN.ACTIVEFORM.buttonclick(_SCREEN.ACTIVEFORM.BUTTONS(2))
-or-
- Another, somewhat more cumbersome workaround for this issue involves checking for KeyPress events in the KeyPress method of a form, similar to the following code snippet:
DO CASE
CASE nKeyCode=30
THISFORM.olecontrol1.buttonclick(THISFORM.olecontrol1.BUTTONS(1))
CASE nKeyCode=48
THISFORM.olecontrol1.buttonclick(THISFORM.olecontrol1.BUTTONS(2))
ENDCASE
STATUS
This behavior is by design.
REFERENCES
(c) Microsoft Corporation 1999, All Rights Reserved. Contributions by John Desch, Microsoft Corporation.
Modification Type: | Major | Last Reviewed: | 5/12/2003 |
---|
Keywords: | kbCodeSnippet kbprb KB249700 |
---|
|