Copy
PowerScript function
Description
Puts selected text or an OLE object on the clipboard. Copy does not
change the source text or object.
Applies to
DataWindow, InkEdit, MultiLineEdit, SingleLineEdit, RichTextEdit,
DropDownListBox, DropDownPictureListBox, OLE controls, and OLE DWObjects
(objects within a DataWindow object that is within a DataWindow
control)
Syntax
1 |
objectref.Copy ( ) |
Argument |
Description |
||
---|---|---|---|
objectref |
One of the following:
The fully qualified name for a DWObject has this
If objectref is a DataWindow, text is copied from the edit |
Return value
Integer for DataWindow, InkEdit, and list boxes, Long for other
controls.
For RichTextEdit controls, Copy returns a long. For other edit
controls and OLE objects, Copy returns an integer.
For edit controls, Copy returns the number of characters that were
copied to the clipboard. If no text is selected in objectref, no
characters are copied and Copy returns 0. If an error occurs, Copy returns
-1.
For OLE controls and OLE DWObjects, Copy returns 0 if it succeeds
and one of the following negative values if an error occurs:
-1 — Container is empty
-2 — Copy Failed
-9 — Other error
If objectref is null, Copy returns null.
Usage
To select text for copying, the user can use the mouse or keyboard.
You can also call the SelectText function in a script. For RichTextEdit
controls, there are several additional functions for selecting text:
SelectTextAll, SelectTextLine, and SelectTextWord.
To insert the contents of the clipboard into a control, use the
Paste function.
Copy does not delete the selected text or OLE object. To delete the
data, use the Clear or Cut function.
Examples
Assuming the selected text in mle_emp_address is Temporary Address,
these statements copy Temporary Address from mle_emp_address to the
clipboard and store 17 in copy_amt:
1 2 |
integer copy_amt copy_amt = mle_emp_address.Copy() |
This example copies the OLE object in the OLE control ole_1 to the
clipboard:
1 2 |
integer result result = ole_1.Copy() |
See also