Well, actually this was my first suggestion. But I think that I am not quite right, because you may check for the ActiveControl in the code assigned to menu bars. From the site I have mentioned I had in mind the line about
ALT+Underlined letter in a menu name...
I have done further testing and this is the result:
Suppose I have a form named test, with a textbox on it named test1 and checkbox named check1. The checkbox caption is Re\<fused. When I press alt+f the following set of events fires:
69542,710, test.KeyPress(33, 4)
69542,710, test.text1.RangeLow()
69542,710, test.text1.RangeHigh()
69542,710, test.text1.Valid()
69542,710, test.text1.LostFocus()
---------------------------------
69542,710, test.check1.When()
69542,721, test.check1.GotFocus()
69542,721, test.check1.Message()
69542,721, test.check1.InteractiveChange()
69542,721, test.Paint()
69542,731, test.check1.Click()
69542,731, test.check1.Valid()
69542,731, test.check1.When()
So that as we can see after pressing the hotkey (KeyPress) the ActiveControl losses focus (LostFocus) and AFTER that we got events on our checkbox (When).
So that processing the code of the WHEN event is in condition that there is no ActiveControl.
See also topic
Tracking Event Sequences from VFP help. Especially see the event sequence in Action 4 - The user presses TAB to move to Text2.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fox7help/html/dgTracking_Event_Sequences.aspThe situation is similar to yours - you press a key so that some of the controls in the form recieves the focus (and the current ActiveControl looses it).
>Hi Zlatin,
>Are you saying that when I put a HotKey on a control, that there is some sort of internal menu generated? The site you pointed to talks about Windows Keyboard Shortcuts, but I couldn't find where the control HotKeys are discussed.
>
>
>>{Alt+} shortcuts are used for menus. Pressing and holding alt activates the menubar area. This is standard Microsoft Windows behaviour. See
>>
>>
http://www.microsoft.com/windows2000/en/server/help/default.asp?url=/windows2000/en/server/help/keys_general.htm>>
< snip >
HTH
Zlatin Zlatev,
MCSD (VS6)Make solutions, not programs!