Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Container Class VS Custom Class
Message
From
28/07/1999 19:21:10
 
 
To
28/07/1999 19:06:55
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00243667
Message ID:
00247461
Views:
26
>David,
>
>I have experimented with this and although you can drop other objects onto a container I have not found how to control the order in which they are created/initialized. Am I missing something or should I not be designing my objects to depend upon a load order?
>
>For example I have created an application class and I have dropped eventlog, screen, environment, version, security and user instances onto it. These objects need to share information between each other that could be obtained when they are initialized if it were done in the right order otherwise I have to finish initializing the objects in the Init method of the application class by calling a seperate method in each child object (.User.setUser(),.Version.setVersion()).
>

Why not add them through the AddObject() method in code in the Init method of the application class; something like:
SET CLASSLIB TO <i>whatever, where ever</i>
WITH this
   .AddObject('User','MyUserClass')
   .AddObject('Version', 'MyVersionClass')
   * pass the result of user.getUserID() as a parameter to the Security object
   .AddObject('Security','MySecurityClass',.user.GetUserID())
   * etc, etc, etc.
ENDWITH
It ain't drag and drop, but it does the job and gives you perfect control.

>I this is the preferred method then I can live with it but I am tempted to define my application class in a .PRG so I can order them as I like. What is you approach?
>
>...tim
>
>>Tim,
>>
>>The only real difference is if you are using the Class Designer you can not drop other objects into a Custom class at design time. They can only be added at runtime using the AddObject() method. Container derived objects also have a visual appearance at runtime whereas Custom does not.
>>
>>>While browsing various class libraries I noticed the use of the container where I would expect a custom class. Could you explain the advantage of this?
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform