Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Lastkey() = 27 in combobox
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00368892
Message ID:
00369001
Vues:
26
What kinds of problems have you had with context and LASTKEY()? I'm using it in my grid.BeforeRowColChange to handle focus, not for field validation. The disadvantage you describe for your method is serious, I would say. But I haven't really done a lot with complicated field validation, either with .Valid events or with field rules.

The Hacker's Guide has some advice on using LASTKEY() with field validation.
>Hi,
>To me, LASTKEY() may but put in the "Things to avoid in VFP" list. You never know if the lastkey() has been used in the context you think it has been. For that reason I NEVER use it ...
>
>So how to resolve validation then ?
>When I validate a field I always accept empty values even there where they're not allowed, but I don't allow to leave a field if it contains an invalid value (other than empty). When the OK/Print/Whatever button is pressed I'm sure that the fields contain a valid value OR are empty. So for those fields that are empty and shouldn't be, I refuse the OK/Print/...
>
>Disadvantage : if the user wants to cancel while filling a field, he first needs to empty it or key in a valid value ...
>
>
>>Hi all,
>>
>>I am using If lastkey() = 27, return .T., endif in the combobox valid.
>>This works fine, however if the user hits cancel or escape and then the add or edit button, they can then click any field on the form and bypass the valid of the field where the cursor is positioned. This seems to be because lastkey() still equals 27.
>>
>>How can I clear lastkey() ?
>>
>>TIA
>>Chris
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform