Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ON KEY LABEL......
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00577245
Message ID:
00577353
Views:
19
>Hi So,
>
>Without actually testing your code - That looks like a workable approach.
>
>As a matter of personal preference, I'd add a custom method to the form called something like AddNewItem (note that I wouldn't use AddItem - it's a built-in method for some native VFP objects). I'd then call thisform.AddNewItem() from both the button's click event and the form's keypress event.
>
>I'd also use a #DEFINE, either in a header file with all the VFP key codes or at the top of the method, instead of the -4. My version of your KeyPress method might look something like:
>
>#DEFINE KEY_F5	-4
>do case
>case nkeycode = KEY_F5
>  thisform.AddNewItem()
>endcase
>
>
>If there's not already one there, I'll upload my VFP_KEYS.h that has all of the VFP keys #DEFINEd to the UT upload area. I just #INCLUDE it in my main #INCLUDE file for each project.
>
>Cheers,
>
>Andrew
>
>>Dear Andrew,
>>
>>Would you show me an example for a KeyPress Event Syntax
>>
>>Is that right for Coding on MyForm.KeyPress()?
>
>do case
>case nkeycode=-4
>	thisform.cmdAddItem.click()
>endcase
>
>>whereas cmdAdditem.click() contains a sequence of code for Add Item to a table.
>>
>>
>>With regards,
>>
>>So

Thanks, Andrew. It would be helpful for me too.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform