Description
Puts selected text from the current row and column of an edit control onto the clipboard. Copy does not change the source text.
Applies to
Syntax
PowerBuilder
integer objectref.Copy ( )
Argument |
Description |
---|---|
objectref |
A reference to a DataWindow control or The fully qualified name of a OLE DWObject within a DataWindow control that contains the object you want to copy to the clipboard. The fully qualified name for a DWObject has this syntax: dwcontrol.Object.dwobjectname |
Return value
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 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, the method returns null.
Usage
To select text for copying, the user can use the mouse or keyboard. You can also call the SelectText method in a script. For the RichTextEdit presentation style in PowerBuilder, there are several additional methods for selecting text: SelectTextAll, SelectTextLine, and SelectTextWord.
To insert the contents of the clipboard into a control, use the Paste method.
Copy does not delete the selected text or OLE object. To delete the data, use the Clear or Cut method.
PowerBuilder environment
For use with other PowerBuilder controls, see the section called “Copy” in PowerScript Reference.
Examples
Assuming the selected text in the edit control of dw_emp is Temporary Address, these statements copy Temporary Address to the clipboard and store 17 in copy_amt:
integer copy_amt copy_amt = dw_emp.Copy()
See also
Clipboard in the section called “Clipboard” in PowerScript Reference