Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
OverRiding SubClasses at RunTime
Message
From
04/05/1998 22:55:44
 
 
To
04/05/1998 20:07:34
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00096608
Message ID:
00096926
Views:
26
You're doing great and you are correct in every respect.

>> Now my concern is that with n forms open, I’m going to have n copies of my oPreference object in memory.

Good point! Here are things that mitigate that. First, when Fox creates an object, the user code and default object properties occupy a single memory instance. Thus if you have 10 instances of class KickADeadWhaleDownTheBeach, all the user code and all the default properties for all those instances are kept in a single memory location. Internally, the only things that are replicated are structures to map individual object read-write properties.

Secondly, the "oPreference" class could itself be a lightweight class. Classes Line, Shape, Custom, Separator are all real light weight. If you can deal with class in a .PRG, classes Relation and DataEnvironment are the lightest of the lightweights.

Thus you could write, in code
DEFINE CLASS MyPreferences AS RELATION
  FUNCTION Execute( toControl)
    IF TYPE( "toControl.BackColor")= "C"
      toControl.BackColor= COL_CHUNKY_BARF
    ENDIF
ENDDEFINE
... and you could have 30 of these in memory and still take far fewer resources than the a single simple form, or a single simple combobox for that matter.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform