Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Losing Focus
Message
De
10/11/2001 10:57:01
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
10/11/2001 10:39:53
Steven Dyke
Safran Seats USA
Texas, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00580131
Message ID:
00580150
Vues:
21
>Cetin,
>
>Do I just give the value of my parameter to the property? What advatage is this?

Steven,
It's visible to all form methods and also to any other routines that has access to that form (something like Formwise public var). Easier to use. You don't have to worry about 'Variable ... ' not found. Try to use local vars + form or object properties instead of global vars.

For example nStatus would hold current status of your process. You might need it from anywhere in form :

* Form init
public nStatus
nStatus = 1

* Somewhere in form
nStatus = 4

This is OK as long as you're sure no other routine would render this useless. ie: A generic program you wrote is called during this process and it also uses a var named nStatus and worse doesn't protect neither its own nor yours. It might say nStatus = 10 somewhere or release it !!!
Or think your form was modeless and another instance launched immediately setting nStatus to 1 !!!


Now as a form property :

*form.init
this.nStatus = 1

*somewhere
thisform.nStatus = 4


It knows it's dealing with nStatus that's a property of its form. Of course this could be used, altered by routines that can access it. However still it does encapsulate it much more effectively than a global var. There are other stuff like protected-hidden to create a more robust encapsulation but it's another story :)
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform