The cloneform statement copies all of the objects in a form (optionally, with modifications) into the active form.


This statement has four parameters:

database – The database containing the form you want to clone. You can use "" for the current database. (Note: The specified database must be open.)

form – The form you want to clone.

property – the object property (color, font, etc.) to modify. See Modifiable Object Properties for descriptions of the different properties that can be modified. Standard properties can be specified in either upper or lower case, but native properties are case sensitive.

value – The new value for this property.


This statement copies all of the objects from a specified form into the current form. Here is a simple example that makes a copy of the current form.

let formName = info("formname")
makenewform formName+" Clone"
openform formName+" Clone"
cloneform "",formName

The objects can be modified as they are copied, for example their position can be shifted. This next example assumes that there is an object in the current form called SwapArea. It starts by deleting any objects inside the swap area, then copies the objects in the form Fresh into this area. The position of the objects is adjusted as the objects are copied so that the objects will be positioned relative to the top left corner of the SwapArea objct. In other words, the procedure replaces whatever objects are currently inside SwapArea with the objects in the Fresh form.

local swapRectangle
swapRectangle = rectangleinset(objectinfo("rectangle","SwapArea"), 1)
// delete any objects inside SwapArea
selectobjects unionrectangle(objectinfo("rectangle"),swapRectangle)=swapRectangle
// copy the objects in the form "Fresh" into the swap area
cloneform "","Fresh","rectangle",

Note: You can specify multiple property/value pairs in a single cloneform statement, like this:

cloneform database,form,property1,value1,property2,value2,property3,value3

or with a dictionary, like this:

cloneform database,form,initializedictionary(property1,value1, ... propertyN,valueN)

The advantage of using a dictionary is that you can prepare it in advance in a variable, and then use it over and over again (possibly adjusting it with the changedictionaryvalues( function).

There are literally hundreds of different object properties that can be modified with the cloneform statement. To learn more, see Modifiable Object Properties.

See Also


10.0NewNew in this version.