>Hi,
>
>Command buttons can have a hotkey defined via the \<. So when the user presses the hot key, the click eventmethod is executed.
>
>But I need to know which (other) control had the focus when the command button was clicked, so I found out that you can set a cActiveControl property to the name of the control that has the focus by issuing
>
>this.cActiveControl=upper(thisform.activecontrol.name)
>
>in the when eventmethod() of the button.
>
>In the Click() eventmethod you can then conditionally execute code based on the setting of the cActiveControl property.
>
>My problem is that when the user presses the hotkey, the when eventmethod() is not executed, so the click() method does not know "who called".
>
>Anybody found a way to encapsulate this functionality in the command button allone, or are we to use the form to manage this?
>
>TIA,
>
>Marc
I saw many times, that Button.When event is highly unreliable in this situation. The 100% guaranteed approach is to subclass form.controls with Thisform.LastActiveControl=This in Parentclass.GotFocus event.
Edward Pikman
Independent Consultant