CopyRTF method (DataWindows)
Description
Returns the selected text, pictures, and input fields in a
RichText DataWindow as a string with rich text formatting. Bitmaps
and input fields are included in the string.
Controls
DataWindow type |
Method applies to |
---|---|
PowerBuilder |
DataWindow control, DataStore object |
Syntax
[PowerBuilder]
1 |
string <span>dwcontrol</span>.<span>CopyRTF</span> ( { boolean <span>selected</span> {, Band <span>band</span> } } ) |
Argument |
Description |
---|---|
dwcontrol |
A reference to a DataWindow control or |
selected |
A value indicating whether to copy selected
|
band |
A value specifying the band from which The default is the band that contains the insertion point. |
Return Values
Returns the selected text as a string.
CopyRTF returns an empty string (“”)
if:
-
There is no selection
and selected is true -
An error occurs
Usage
CopyRTF does not involve the clipboard.
The copied information is stored in a string. If you use the standard
clipboard methods (Copy and Cut)
the clipboard will contain the text without any formatting.
To incorporate the text with RTF formatting into another RichTextEdit control,
use PasteRTF.
For use with RichTextEdit controls, see CopyRTF in
the PowerScript Reference. For information
about rich text format, see the chapter about implementing rich
text in Application Techniques.
Examples
This statement returns the text that is selected
in the RichText DataWindow dw_letter and stores it in the
string ls_richtext:
1 |
string ls_richtext |
1 |
ls_richtext = dw_letter.<span>CopyRTF</span>() |
This example copies the text in dw_1, saving
it in ls_richtext, and pastes it into dw_2. The
user clicks the RadioButton rb_true to copy selected text and
rb_false to copy all the text. The number of characters
pasted is saved in ll_numchars reported in the StaticText
st_status:
1 |
string ls_richtext |
1 |
boolean lb_selected |
1 |
long ll_numchars |
1 |
1 |
IF rb_true.Checked = true THEN |
1 |
lb_selected = true |
1 |
ELSE |
1 |
lb_selected = false |
1 |
END IF |
1 |
1 |
ls_richtext = dw_1.<span>CopyRTF</span>(lb_selected) |
1 |
ll_numchars = dw_2.PasteRTF(ls_richtext) |
1 |
st_status.Text = String(ll_numchars) |