Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Prgs vs Methods
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Titre:
Divers
Thread ID:
00176041
Message ID:
00180348
Vues:
23
>There is some thought that forms that will not be sub-classed should use prgs instead of methods. The arguments are
>
>1. It is much eaiser to modify a prg. You can see all functions and procedures, therefore its easier to modify the code.
>
>2. You can make modifications while the form is running.
>
>3. In general its easier to add variables and procedures to a prg than it is to add properties and methods to a form.
>
>4. If the client has a VFP on their site, and the prgs are excluded, you can easily step through the code as long as the prgs have been excluded in an Exe. You could even make modifications while the Exe is running on the client site.
>
>Any thoughts?

I usually only add one property to the form base class. Say .bObject
Then I create custom classes in a .prg file (ex):

myObj.prg
#include isr.h
DEFINE CLASS cName AS CUSTOM
lContinue = .f.
cName = ''

function reset
this.lContinue = .f.
this.cName = ''
endfunc

function buildName
this.cName = myAlias.firstname + ' ' + myAlias.lastname
endfunc

function destroy
*add anything you need done...
endfunc
ENDDEFINE

Then in my form load event I have:
set proc to myObj additive
thisform.bObject = createObject('cName')

I refer to the methods and properties as:
? thisform.bObject.lContinue
thisform.txtName.caption = thisform.bObject.buildName()

In other words, I think I have the best of both worlds. I don't like having to weed through the form methods and properties, I have them all in one place.

Robert
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform