Navigation: Language Reference > 13 - Built-in Functions >====== CLONE(duplicate existing control) ====== | |
CLONE(destination control, source control [,parent] [,position] [,window])
CLONE | Duplicates an existing control. |
destination control | A field number or field equate label for the control to create. |
source control | A field number or field equate label for the control to duplicate. |
Parent | A field number or field equate label that specifies the OPTION, GROUP, SHEET, TAB, MENU, HEADER, FOOTER, DETAIL, BREAK, or FORM to contain the new control. If omitted, the control has no parent. |
Position | An integer constant, expression, or variable that specifies the position within a MENU to place a new ITEM control. If omitted, the ITEM is added to the end. |
Window | The label of an APPLICATION, WINDOW, or REPORT structure, or a reference to any of those structures where the control to duplicate exists. |
CLONE dynamically duplicates an existing control to the currently active window. This procedure is valid in Clarion Win32 Windows, and also for REPORT structures in both Clarion Win32 and Clarion#. It returns the field equate label of the new control. The destination control inherits all properties of the source control. The position of the destination control should be modified using SETPOSITION() or PROP:AT if it will not be positioned on top of the source control.
CLONE may only be used to duplicate controls. It may not be used to duplicate report bands, menu items, or OLE controls.
Return Data Type: | SIGNED |
Example:
PROGRAM
INCLUDE('EQUATES.CLW')
INCLUDE('KEYCODES.CLW')
MAP
END
WINDOW WINDOW('Clone - example'),AT(,,260,100),GRAY
BUTTON('Ok'),AT(198,30,31,15),USE(?OkButton)
BUTTON('Clone It'),AT(199,54,31,15),USE(?CloneButton)
END
WINDOW2 WINDOW('Window2'),AT(,,260,100),GRAY
BUTTON('Clone Me'),AT(98,30,31,15),USE(?CloneMe)
END
?Cloned EQUATE(100)
CODE
OPEN(WINDOW)
ACCEPT
CASE ACCEPTED()
OF ?CloneButton
OPEN(WINDOW2)
SETTARGET(WINDOW)
CLONE(?Cloned, ?CloneMe,,,WINDOW2)
CLOSE(WINDOW2)
?Cloned{PROP:YPOS} = ?Cloned{PROP:Ypos} + ?Cloned{PROP:Height} +10
?Cloned{PROP:Width} = ?Cloned{PROP:Width} + 20
?Cloned{PROP:Text} = 'Cloned Button'
OF ?OkButton
BREAK
END
END
See Also: CREATE, SETPOSITION, SETTARGET, UNHIDE