On May 13, 2006, at 4:03 PM, Norman Palardy wrote:


On May 13, 2006, at 1:24 PM, Phil M wrote:
A Computed Property does not have it's own storage for the value... so you have to have a real property backing it in some way.

What I like to do is use Computed Properties to "forward" properties of embedded classes or controls. In the case of ContainerControls, I forward properties of controls that I would like to edit directly... like TextFont and TextSize for an embedded EditField control. Another use is that I like combining private properties into a Dictionary instance and then provide access to these properties via Computed Properties.

In my opinion, Computed Properties are most useful when something needs to happen when the value changes. For example if you have a BackgroundColor property for a custom control, you will need to redraw the control to reflect the change.


As an aside these are all things that can be done with a pair of regular methods. About the only "advantage" a computed property has over a pair of methods is that it can be viewed in the debugger. The pair of methods is equally flexible, and an be back used in v5.5 while a computed property cannot.

I can't think of any other advantage a computed property has.

They cannot be overridden.

Charles Yeomans
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to