Hi So,
On Key Label happens outside the scope of the form, so you can't use the THISFORM construct. You have a few options:
- As Michael has suggested, add a button a hotkey to the button (although this won't let you use F5)
- Use the form's keypress event and set KeyPreview to .T.
- Set a public variable to reference the form object and ON KEY LABEL F5 return goForm.cmdAddItem.Click()
- Add a menu or popup with a hotkey that calls the method.
Note that you can use 1 and 2 together to give more than one way to get at the functionality.
HTH
Cheers,
Andrew
>Dear all.
>
>Suppose I have a commandbutton 'cmdAddItem' on the form 'MyForm'. At the init event of the form 'MyForm' I have the coding segment:
>
>On Key Label F5 thisform.amdAddItem.click()
>
>so that the user may do the same job by clicking the commandbutton or press {F5}
>
>Is this possible or otherwise any alternative?
>
>
>
>With regards,
>
>
>
>Ransome
If we were to introduce Visual FoxBase+, would we be able to work from the dotNet Prompt?
From Top 22 Developer Responses to defects in Software
2. "It’s not a bug, it’s a feature."
1. "I thought I fixed that."
All my FoxTalk and other articles are available on my
web site.
Unless specifically identified otherwise, anthing posted here is purely my opinion and may or may not reflect the policies or practices of Microsoft.