Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Control Object vs. Container Object
Message
From
19/04/2018 14:02:54
 
 
To
19/04/2018 11:00:36
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
01659539
Message ID:
01659542
Views:
95
>Hi all!
>
>What are the basic advantages to use the Control Object in using the Container Object?
>
>Is it faster?
>Or is it only the encapsulation?

Control is more "puristic" in that it hides all objects from outside reference, so it helps you to write more manageable code.

If you had a timer control on the container it would be like:
loContainerObject = Newobject("MyContainer","Classlib.vcx")
loContainerObjecct.tmr.Enabled = .T.
With a control it properly hides the timer and you need to create a method on the control:
loControlObject = Newobject("MyControl","Classlib.vcx")
loControlObject.Start()
Latter is the better solution, because the calling object should not need to understand the inner plumbing of the object's logic. This is the same logic in C# for instance, so other developers might be more familiar with it.
Christian Isberner
Software Consultant
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform