SelectedText
PowerScript function
Description
Obtains the selected text in an editable control.
Applies to
DataWindow, EditMask, InkEdit, MultiLineEdit, SingleLineEdit,
RichTextEdit, DropDownListBox, and DropDownPictureListBox controls
Syntax
|
1 |
editname.SelectedText ( ) |
|
Argument |
Description |
|---|---|
|
editname |
The name of the DataWindow, EditMask, MultiLineEdit, For a DropDownListBox or DropDownPictureListBox, the For a DataWindow, it reports the selected text in the edit |
Return value
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 B. Smith and
James B. is selected, these statements set the value of emp_fname to James
B:
|
1 2 |
string ls_emp_fname ls_emp_fname = mle_Contact.SelectedText() |
If the selected text in the edit portion of the DropDownListBox
ddlb_Location is Maine, these statements display the ListBox
lb_LBMaine:
|
1 2 3 4 5 6 7 |
string ls_Loc ls_Loc = ddlb_Location.SelectedText() IF ls_Loc = "Maine" THEN lb_LBMaine.Show() ELSE ... END IF |
See also