Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Menu Shortcuts
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Titre:
Divers
Thread ID:
00454279
Message ID:
00454850
Vues:
23
>I had some afterthoughts over the weekend, and I’m again not perfectly happy with my save/cancel handling when the current control’s valid returns .f. or 0.
>Now, if the user wanted to save, I’ll just prevent this and display a message, this does not require any code in the valid.
>But if the user wants to cancel it looks that there is no way to do it without some code in the valid.
>
>
if lastkey()=17 or lastkey()=27 or ...
>  return .t.
>endif
>
>I’m thinking that, if I put the above code in the valid of all our control classes, it would be easier to have:
>
>
dodefault()
>>>specific valid code<<
>
>than
>
>
if lastkey()=17 or lastkey()=27 or ...
>  return .t.
>endif
>>>specific valid code<<
>
>But then, dodefault() is a sign of bad design, is it?
>What do you think?
>

Not at all! Where'd you get that idea?

FWIW, if valid returns 0 or .F., I think displaying a message that the data isn't valid and can't be saved is perfectly acceptable. If you want, you could offer to discard changes instead, and call the same method as the cancel button.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform