Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Where do I enable/disable
Message
De
20/08/1998 13:08:30
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00128401
Message ID:
00128553
Vues:
57
Hi Peter ---

>your last suggestion ( customised controls ) is exactly what I want to do, as all my forms will use these base controls/classes, I just need some help as to where to put the code, initially I put it in the Init of each class but as the Forms' mode property is set/reset by a parameter passed to the form, this was no good as the controls are instantiated before the forms inits' fired
>I'm sure the old days were easier!?


Haha...the old days were harder. At least now you have a somewhat consistant OOP paradigm...I remember going nuts trying to debug someone's 2.6 code where the guy was storing procs in snippets, menu code, PRGs, et al...anyway on to the business at hand:

Try putting the enabled/disable check in the Refresh() event of each control...let each control check and modify it's own state (this is known as encapusulating behaviour). In the Form's Init, you can do a THISFORM.Refresh() to make sure they start out the way you want them. Your code in the Refresh of each control can be:
*** Control.Refresh() method
THIS.Enabled=IIF(THISFORM.Mode="VIEW",.T.,.F.)
That's all there is to it!
------------------------------------------------
John Koziol, ex-MVP, ex-MS, ex-FoxTeam. Just call me "X"
"When the going gets weird, the weird turn pro" - Hunter Thompson (Gonzo) RIP 2/19/05
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform