Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
OverRiding SubClasses at RunTime
Message
 
 
To
05/05/1998 10:39:03
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00096608
Message ID:
00097041
Views:
26
Bob,

>The common memory location for multiple instances of the oPreference class’s code and default properties came as a surprise. If I’ve got it right, I think you are saying that a parallel, writable version of each of the class’s properties is created at instantiation for each instance of the class and its these writable copies that I am actually reading (and potentially writing) ... a little like private datasessions for class instances.

Each object has a "data structure" in memory holding the current values of all of it's properties. When VFP instantiates the first of a particular subclass, the default properties values and method code is loaded into memory. Then the object properties are loaded from the defaults and then they are manipulated from there on out by your overrides on the property sheet and your code. But every object of that class points to the one copy of the method code in memory. It's just like a UDF in that regard, you can have 50 references to it in your code but the UDF code is only loaded in memory once.

>While I’m at it, what is the IF TYPE( “toControl.BackColor”) = “C” protecting us from? That is, how could our control not exist if we are passing only controls found in our form with FOR EACH oControl in THIS.Controls

It's possible that not all objects that you send to the oPreference object will have a BackColor property (Custom for example doesn't have color properties). Or the property might have been marked hidden, which can cause problems.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Reply
Map
View

Click here to load this message in the networking platform