Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Form's Keypress Cannot Reference Thisform.object.method
Message
 
 
À
18/10/1999 20:46:28
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00277952
Message ID:
00278046
Vues:
17
Are you using that code snippet within a PRG file, or actually within a method of the form? The former will NOT work if you try to reference ThisForm. You have to pass the form as an object reference to any "external" PRG files.

>I am using a form´s Keypress method to monitor the use of function keys which in place must activate the Click method of some buttons, depending on the key pressed by the user. To achieve this I wrote the following case statement:
>
>

>LPARAMETERS nKeyCode, nShiftAltCtrl
>do case
> case nKeyCode=keyF2
> thisform.cmdToday.click
> case nKeyCode=keyF5
> thisform.cmdAdd.click
> case nKeyCode=keyF6
> thisform.cmdEdit.click
> case nKeyCode=keyF7
> thisform.cmdDelete.click
>endcase
>

>
>NOTE: keyF1 through keyF10 are predefined constants with the corresponding codes for the function keys.
>
>During runtime the form (with the buttons) is loaded, but when I press one of the designated Keys the following
>error message appears:
>
> THISFORM can only be used within a method
>
>What am I missing and how can I designate actions to keys pressed within an active form ?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform