Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Overirding events in a custome class
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00124572
Message ID:
00124580
Vues:
18
>I have created a data entry form for employees and have used the wizstyle class to add a navigational tool bar to my form when i add a record i want the add click event to check for duplicate employee ids that the user is keying in manually. Currently I get the default message of a unigue record being found.

Make a new "hook" method for WIZSTYLE (or your version of it) called "validation" or something, and leave it blank in the class. Have this method get called in the Save code, a little bit before the TABLEUPDATE. Individual instances of the class can have code here for any sort of validation specific to that application. That code can check values or whatever, as long as it doesn't try to move the record pointer. If the specific code finds an invalid value, it can return something which, in the Save code, will prevent saving and TABLEUPDATE and will return the user to the form, still in "edit" mode.

By the way, you can have a similar "hook" called "defaults" or something, at the beginning of "edit" mode, called in the Add.click in place of APPEND BLANK. The way I do it, the class code in the "defaults" method just has APPEND BLANK. (A stored procedure makes my surrogate key here, just like in TASTRADE). If the specific application requires some defaults, the specific instance of the class will have INSERT INTO mycursor(field4, field7) VALUES (default4, default7) which replaces the APPEND BLANK.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform