4D v13.4OBJECT DUPLICATE |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v13.4
OBJECT DUPLICATE
OBJECT DUPLICATE
The OBJECT DUPLICATE command is used to create a copy of the object designated by the object parameter in the context of the form being executed (Application mode). The source form, generated in Design mode, is not modified. By default, all the options specified in the Property list for the source object are applied to the copy (size, resizing options, color, etc.), including any associated object method.
If you pass the optional * parameter, you indicate that the object parameter is an object name (string). If you do not pass this parameter, you indicate that the object parameter is a field or a variable. In this case, you pass a field or variable reference (object field or variable only) instead of a string. Pass the name assigned to the copy of the object in the newName parameter. This name must be in keeping with the rules for naming objects and be unique in the form. If it is not valid or already used by another object, the command does nothing and the OK variable returns 0.
Pass a pointer to the variable to be associated with the new object in newVar. As a rule, you must point to a variable of the same type as the that of the source object but certain kinds of "retyping" are possible. The command provides automatic functions to facilitate writing generic code:
If the variable type is not compatible with the object, the command does nothing and the OK variable is set to 0. If you omit this parameter, the variable is created dynamically by 4D (see the paragraph Dynamic Variables). If you duplicate a static object (lines, rectangle, static picture, etc.), this parameter is ignored. Pass a Nil (->[]) pointer if you want to be able to use the other parameters. You use the boundTo parameter in two cases:
If you omit this parameter or pass an empty string, the new object becomes the last enterable object of the form page. In the case of a radio button, the object is attached to the group of the source button. The new object can be moved and resized via the moveH, moveV, resizeH and resizeV parameters. As with the OBJECT MOVE command, the direction of the move or the resizing is specified by the sign of the values passed in the moveH and moveV parameters:
By default, the values of moveH, moveV, resizeH and resizeV modify the coordinates of the object in relation to its previous position. If you want for these parameters to specify absolute coordinates, pass the optional final * parameter. This command must be used in the context of the display of a form. It will generally be called in the On Load form event or following a user action (On Clicked event). Note: If the On Load form event is associated with the source object, it is generated for the duplicated object when the command is executed. This allows, for example, the value of the object to be initialized. For technical and logical reasons, OBJECT DUPLICATE cannot be called within the certain form events, in particular:
When the command is called in a context that is not supported,the object is not duplicated and the OK variable is set to 0. If it is called in a printing context, the error -10601 is generated as well. If the command was executed correctly, the OK variable is set to 1. Otherwise, it is set to 0. Creation of a new button named "CancelButton" on top of the existing "OKButton" object and association with the vCancel variable: OBJECT DUPLICATE(*;"OKButton";"CancelButton";vCancel) Creation of a new radio button "bRadio6" based on the existing radio button "bRadio5". This button will be associated with the variable <>r6, integrated with the group of the "bRadio5" button and placed 20 pixels above it: OBJECT DUPLICATE(*;"bRadio5";"bRadio6";<>r6;"bRadio5";0;20) |
PROPERTIES
Product: 4D
INDEX HISTORY
Created: 4D v12 SEE ALSO
Form objects |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||