On Jun 2, 2006, at 2:58 PM, Jay Wooten wrote:
Suppose you create a custom canvas:
That canvas has a Getter/Setter pair to retrieve/store a string in
a property. Assume the canvas control is called myCanvas.
Sub SetText( theText as string)
MyText = theText
End Sub
and
Sub GetText() as string
return MyText
End Sub
You call the methods externally as such
myCanvas.SetText("some text")
and
someText = myCanvas.GetText()
Now lets say you make the daring decision to put the canvas control
inside a Containercontrol, but you still need to be able to set/get
the string stored in the canvas externally to the Container.
Is it most appropriate to create a Getter/Setter pair of methods
for the Container Control that passes on the values on to the
myCanvas control?
i.e.
Container control methods:
Sub SetText( theText as string )
myCanvas.SetText(theText)
End Sub
Sub GetText() as string
return myCanvas.GetText()
End Sub
Or is there a better way to do this?
I think that this is precisely what you should do. You'll appreciate
it if, for instance, you decide to rename the canvas. Computed
properties are great for this sort of thing.
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>