Copy

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

DataWindow type

Method applies to

PowerBuilder

DataWindow control, OLE DWObject

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 

Returns

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:

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.

NotePowerBuilder environment For use with other PowerBuilder controls, see Copy in the PowerScript Reference.

Examples

Example 1

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