Cut PowerScript function
Description
Deletes selected text or an OLE object from the specified
control and stores it on the clipboard, replacing the clipboard
contents with the deleted text or object.
Controls
DataWindow, InkEdit, MultiLineEdit, SingleLineEdit, DropDownListBox, DropDownPictureListBox,
and OLE controls
Syntax
1 |
<span>controlname</span>.<span>Cut</span> ( ) |
Argument |
Description |
---|---|
controlname |
The name of the DataWindow, InkEdit, If controlname is a DataWindow, text |
Return Values
Integer for DataWindow, InkEdit, and
list boxes, Long for other controls.
For editable controls, Cut returns the
number of characters that were cut from controlname and
stored in the clipboard. If no text is selected, no characters are cut
and Cut returns 0. If an error occurs, Cut returns
-1.
For OLE controls, Cut returns 0 if it succeeds
and one of the following negative values if an error occurs:
-
-1 Container is empty
-
-2 Cut failed
-
-9 Other error
If controlname is null, Cut returns null.
Usage
To select text for deleting, 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.
To delete selected text or an OLE object but not store it
in the clipboard, use the Clear function.
Cutting an OLE object breaks any connections between it and
its source file or storage, just as Clear does.
Examples
Assuming the selected text in mle_emp_address is
Temporary, this statement deletes Temporary from mle_emp_address,
stores it in the clipboard, and returns 9:
1 |
mle<span>_</span>emp_address.<span>Cut</span>() |
This example cuts the OLE object in the OLE control ole_1 and
puts it on the clipboard:
1 |
integer result |
1 |
result = ole_1.<span>Cut</span>() |