ReplaceText method (DataWindows)
Description
Replaces selected text in the edit control for the current
row and column with a specified string.
Controls
DataWindow type |
Method applies to |
---|---|
PowerBuilder |
DataWindow control |
Web ActiveX |
DataWindow control |
Syntax
[PowerBuilder]
1 |
long <span>editname</span>.<span>ReplaceText</span> ( string <span>string</span> ) |
[Web ActiveX]
1 |
number <span>editname</span>.<span>ReplaceText</span> ( string <span>string</span> ) |
Argument |
Description |
---|---|
editname |
A reference to a DataWindow control |
string |
The string that replaces the selected |
Return Values
Returns the number of characters in string and –1
if an error occurs.
If any argument’s value is null, in PowerBuilder
and JavaScript the method returns null.
Usage
If there is no selection, ReplaceText inserts
the replacement text at the cursor position.
To use the contents of the clipboard as the replacement text,
call the Paste method instead of ReplaceText.
For use with other PowerBuilder controls, see ReplaceText in
the PowerScript Reference.
Examples
If the DataWindow edit control 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 text in the edit control
is “Offer Good for 60 Days”:
1 |
dw_salesoffer.<span>ReplaceText</span>("60 Days") |
If there is no selected text, this statement inserts “New
product” at the cursor position in the edit control for
dw_products:
1 |
dw_products.<span>ReplaceText</span>("New product") |