Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Objects and Variables in a Form
Message
De
10/12/1998 19:28:02
 
 
À
10/12/1998 17:00:44
Andy Roth
Neyenesch Printers
Californie, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00165931
Message ID:
00166388
Vues:
13
>>>Are all objects in a form PRIVATE by nature even if their
>>>name is the same as a public object or variable?
>>>
>>>I know all variables in a program or procedure are
>>>private unless they are the same name as a public one.
>>>In that case you need to declare the varible as PRIVATE.
>>>
>>>How do you declare an object in a form as private?
>>>can you declare all objects at once in the form as private?
>>
>>
>>To understand the nature of your question, it is necessary to understand what happens when an object is created. The general syntax of an object is;
>>
>>Public (or Private) NewObjectName
>>NewObjectName = CreateObject("ParentClass")
>>
>>The scope of the object is dependant on whether the object is declared as public or private. I would recommend avoiding public objects that only have function or use within a particular form or method.
>>
>>Public objects are great for error handling, data access, things like that that will be needed throughout the application.
>>
>>Just a thought or two on the subject.
>>
>>Regards,
>>
>>Jason
>
>What would be the default scope of a form and it's objects contained within?


For the form, it would depend on how you instantiate it. For example

Public myForm
myForm = CreateObject('Form')

is public (duh Jason, anyone could figure that out)

Saying

myForm = CreateObject('Form')

Without any other qualifiers would make a form local to where ever the code fired. *NOTE* I haven't tried doing this, so I won't guarantee the results.

Then if you create objects within the form like text boxes, lables, command buttons etc ... If the form is released, they would be released as well unless they were declared as Public.

Regards,
Jason Tryon
Senior Systems Analyst / Technical Lead
eBusiness / iPage
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform