ReplaceText – PB Docs 2022

ReplaceText

PowerScript function

Description

Replaces selected text in an edit control with a specified
string.

Applies to

DataWindow, EditMask, InkEdit, MultiLineEdit, SingleLineEdit,
RichTextEdit, DropDownListBox, and DropDownPictureListBox controls

Syntax

Argument

Description

editname

The name of the DataWindow, EditMask, InkEdit,
MultiLineEdit, SingleLineEdit, RichTextEdit, DropDownListBox, or
DropDownPictureListBox control in which you want to replace the
selected string.

In a DataWindow control, the text is replaced in the edit
control over the current row and column.

string

The string that replaces the selected text.

Return value

Integer for DataWindow, InkEdit, and list boxes, Long for other
controls.

For InkEdit, returns 1 for success and -1 if an error occurs. For
other controls, returns the number of characters in string and -1 if an
error occurs. If any argument’s value is null, ReplaceText returns
null.

Usage

If there is no selection, ReplaceText inserts the replacement text
at the cursor position.

In a RichTextEdit control, the selection can include
pictures.

Other ways to replace text

To use the contents of the clipboard as the replacement text, call
the Paste function, instead of
ReplaceText.

To replace text in a string, rather than a control, use the Replace function.

Examples

If the MultiLineEdit mle_Comment contains Offer Good for 3 Months
and the selected text is 3 Months, this statement replaces 3 Months with
60 Days and returns 7. The resulting value of mle_Comment is Offer Good
for 60 Days:

If there is no selected text, this statement inserts “Draft” at the
cursor position in the SingleLineEdit sle_Comment3:

See also

Copy

Cut

Paste


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x