SelectedLength – PB Docs 126

SelectedLength PowerScript function

Description

Determines the total number of characters in the selected
text in an editable control, including spaces and line endings.

Controls

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

Syntax

Argument

Description

editname

The name of the DataWindow, EditMask,
MultiLineEdit, SingleLineEdit, RichTextEdit, DropDownListBox, or DropDownPictureListBox
control in which you want the length of the selected text.

For a DataWindow, it reports the length of the selected text
in the edit control over the current row and column.

Return Values

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

Returns the length of the selected text in editname.
If no text is selected, SelectedLength returns
0. If an error occurs, it returns -1. If editname is null, SelectedLength returns null.

Usage

Except for text in rich text controls, the characters that
make up a line ending (produced by typing Ctrl+Enter or
Enter) can be different on different platforms. On Windows, it is
a carriage return plus a line feed and equals two characters when
calculating the length. On other platforms, a line ending is a single
character. A line that has wrapped has no line-ending character.
For DropDownListBox and DropDownPictureListBox controls, SelectedLength returns
-1 if the control’s AllowEdit property is set to false.

note.png RichTextEdit controls

For rich text controls, a carriage return plus a line feed
always count as a single character when calculating the text length.

note.png 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
selected text in the MultiLineEdit mle_Contact is
John Smith, then this example sets li_length to
10:

See Also


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