SelectedText PowerScript function
Description
Obtains the selected text in an editable control.
Controls
DataWindow, EditMask, InkEdit, MultiLineEdit, SingleLineEdit, RichTextEdit,
DropDownListBox, and DropDownPictureListBox controls
Syntax
|
1 |
<span>editname</span>.<span>SelectedText</span> ( ) |
|
Argument |
Description |
|---|---|
|
editname |
The name of the DataWindow, EditMask, For a DropDownListBox or DropDownPictureListBox, the AllowEdit For a DataWindow, it reports the selected text in the edit |
Return Values
String. Returns the selected text in editname.
If there is no selected text or if an error occurs, SelectedText returns
the empty string (“”). If editname is null, SelectedText returns null.
Usage
In a RichTextEdit control, any pictures in the selection are
ignored. If the selection contains input fields, the names of the
input fields, enclosed in brackets, become part of the string SelectedText returns.
The contents of the input fields are not returned.
For example, when the salutation of a letter is selected, SelectedText might return:
|
1 |
Dear {title} {lastname}: |
Focus and the selection in a drop-down list
When a DropDownListBox or DropDownPictureListBox loses focus,
the selected text is no longer selected.
Examples
If the
text in the MultiLineEdit mle_Contact is James and
B. SmithJames B. is
selected, these statements set the value of emp_fname to James:
B
|
1 |
string ls_emp_fname |
|
1 |
ls_emp_fname = mle_Contact.<span>SelectedText</span>() |
If the selected text in the edit portion of the DropDownListBox ddlb_Location is Maine,
these statements display the ListBox lb_LBMaine:
|
1 |
string ls_Loc |
|
1 |
ls_Loc = ddlb_Location.<span>SelectedText</span>() |
|
1 |
IF ls_Loc = "Maine" THEN |
|
1 |
lb_LBMaine.Show() |
|
1 |
ELSE |
|
1 |
... |
|
1 |
END IF |