Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Another Cheezy Tip of the Week (VFP6)
Message
De
12/07/1998 21:20:09
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Another Cheezy Tip of the Week (VFP6)
Divers
Thread ID:
00116665
Message ID:
00116665
Vues:
53
Since the advent of VFP, most people control the state of their forms through a custom form property. For example, we may have a form property called EditState with valid values of 0(idle),1(editing),2(appending).

So, typically, in the Click() method of an Edit button on a form, you may have similar to the following (but probably more complicated):
THISFORM.EditState=1             
THISFORM.SetAll("Enabled",.T.)   
THISFORM.Refresh()
With VFP6, there is a much simpler way to do this. With the new ASSIGN method, you can add an _Assign to any property, custom or native. So...we would create an EditState_Assign method for our form, with the following code (THIS not THISFORM as its a form method):
LPARAMETERS tNewVal
THIS.EditState=tNewVal
THIS.SetAll("Enabled",.T.)
THIS.Refresh()
The Edit button Click() method is reduced to nothing but THISFORM.EditState=1. The EditState_Assign method automatically does the rest, encapsulating the behavior of a state change at the level it belongs.

TTFN!
------------------------------------------------
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform