Paste

Description

Inserts (pastes) the contents of the clipboard into the specified control. If no text is selected in the control, the text on the clipboard is pasted at the insertion point. If text is selected, Paste replaces the selected text with the text on the clipboard.

Applies to

DataWindow type

Method applies to

PowerBuilder

DataWindow control


Syntax

PowerBuilder

long dwcontrol.Paste ( ) 

Argument

Description

dwcontrol

A reference to a DataWindow control. Text is pasted into the edit control over the current row and column.


Return value

Returns the number of characters that were pasted into the edit control for dwcontrol. If nothing has been cut or copied (the clipboard is empty), Paste does not change the contents of the edit control and returns 0. If the clipboard contains nontext data (for example, a bitmap or OLE object) and the control cannot accept that data, Paste does not change the contents and returns 0.

If dwcontrol is null, in PowerBuilder and JavaScript the method returns null.

Usage

The text is pasted into the edit control over the current row and column. If the clipboard contains more text that is allowed for that column, the text is truncated. If the clipboard text does not match the column's datatype, all the text is truncated, so that any selected text is replaced with an empty string.

To insert a specific string in dwcontrol or to replace selected text with a specific string, use the ReplaceText method.

PowerBuilder environment

For use with other PowerBuilder controls, see the section called “Paste” in PowerScript Reference.

Examples

If the clipboard contains "Proposal good for 90 days" and no text is selected in the edit control of dw_rpt, this statement pastes "Proposal good for 90 days" at the insertion point in the edit control and returns 25:

dw_rpt.Paste()

If the clipboard contains the string "Final Edition", the edit control in dw_rpt contains "This is a Preliminary Draft", and the text in edit control is selected, this statement deletes "This is a Preliminary Draft", replaces it with "Final Edition", and returns 13:

dw_rpt.Paste()

See also

Copy

Cut

ReplaceText