CloneObject

This cool method lets you create an exact (well, almost exact) duplicate of an object. The only difference between the two is the name you assign the new one. The only bad thing we have to say about CloneObject is that it's available only at design-time—we can think of all kinds of cool things we could do with it at runtime.

Usage

oObject.CloneObject( cNewName )
The newly cloned object becomes a member of the same container the original object is in. That is, if you clone a label on a form, the new label is added to the same form. All the properties and methods of the original are copied to the clone.

Example

* Assume the Form Designer is open and a single object (that
* sits right on the form) is selected.
= ASELOBJ(aObject)    && Get a reference to the selected object
= ASELOBJ(oContainer, 1)     && Get a reference to the form
aObject[1].CloneObject( "NewOne" )
* Now we can reference it through the container
? oContainer[1].NewOne.Name  && Returns "NewOne"

See Also

AddObject, AddProperty, ASelObj()


Back to Table of Contents

Copyright © 2002-2018 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. Click for license .