Adding a CopyFrom

Attributes that are members of the stereotype class <<Copy>> (described as a CopyIspec) posses the capability of being painted on a form multiple times, each instance being a unique representation of the attribute. This capability is known as a Copy.From and is determined by the Is Copied property of the graphical object.

To add a CopyFrom to the form, open the CopyIspec in the painter, refer to Dragging an Attribute from the Class View or Dragging Objects from the Toolbox.

If an attribute is dragged onto the form, a default Text Field is created. Select the attribute and set the IsCopied property to "True". This creates additional copies of the text field corresponding to the Copies property of the CopyIspec and a sequence number appears in the Sequence property of the graphical object in the Properties window. The sequence number determines the sequence in which the objects are displayed at runtime and is adjusted whenever an object is removed from the form. Default TextField objects are created if there is no existing object associated with the attribute.

Therefore, if the number of the Copies property of the CopyIspec is 5 and the Iscopied property is set to True, 5 object copies are painted. These text field copies behave as individual controls, except that they are attached to the same attribute and have the CopySequence property.

If you drag an object from the Toolbox onto the form, instead of dragging an attribute from the Class View, the object appears on the form. Set the IsCopied property to True again to create the additional copies of the object.

Once the object copies have been painted on the form, you can change the number in the Copies property of the CopyIspec to a different value. If you do so, you are prompted to Save and Refresh the form to display an equivalent number of copies, or to Ignore and restore the original value in the Copies property.

Once you have added the number of CopyFrom objects to a form, they can be manipulated individually in the same way as any other object, and can be grouped using a GridPanel.

Note: If you attempt to add an attribute that does not have the CopyFrom capability, more than once to a form, it will not succeed. Refer to Copy in Presentation of Insertable Classes for more information on the <<Copy>> class.