Connection Information

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.

Connection Type

Cursor position in the RichTextEdit control – PB Docs 2019 – PowerBuilder Library

Cursor position in the RichTextEdit control – PB Docs 2019

Cursor position in the RichTextEdit control

Functions provide several ways to find out what is selected and to
select text in the RichTextEdit control.

Where is the insertion point or what is
selected?

The text always contains an insertion point and it can contain a
selection, which is shown as highlighted text. When there is a
selection, the position of the insertion point can be at the start or
the end of the selection, depending on how the selection is made. If the
user drags from beginning to end, the insertion point is at the end. If
the user drags from end to beginning, the insertion point is at the
beginning.

The Position function provides information about the selection and
the insertion point.

For more information, see the section called “Position” in PowerScript Reference.

Changing the cursor image

The Pointer page of the Rich Text Object property sheet has a list
box with stock pointers that can be used to indicate cursor position in
a RichTextEdit control or RichText DataWindow. Users can change the
cursor image at runtime by selecting one of these pointers and clicking
OK in the Rich Text Object property sheet.

Selecting text
programmatically

There are several functions that select portions of the text
relative to the position of the insertion point:

  • SelectTextWord

  • SelectTextLine

  • SelectTextAll

A more general text selection function is SelectText. You specify
the line and character number of the start and end of the
selection.

Passing values to
SelectText

Because values obtained with Position provide more information
than simply a selection range, you cannot pass the values directly to
SelectText. In particular, zero is not a valid character position when
selecting text, although it is meaningful in describing the
selection.

For more information, see the section called “Position” in PowerScript Reference.

For an example of selecting words one by one for the purposes of
spell checking, see the section called “SelectTextWord” in PowerScript Reference.

Tab order, focus, and the
selection

Tab order

For a window or user object, you include the RichTextEdit control
in the tab order of controls. However, after the user tabs to the
RichTextEdit control, pressing the tab key inserts tabs into the text.
The user cannot tab out to other controls. Keep this in mind when you
design the tab order for a window.

Focus and the selection

When the user tabs to the RichTextEdit control, the control gets
focus and the current insertion point or selection is maintained. If the
user clicks the RichTextEdit control to set focus, the insertion point
moves to the place the user clicks.

LoseFocus event

When the user clicks on a RichTextEdit toolbar, a LoseFocus event
occurs. However, the RichTextEdit control still has focus. You can check
whether the control has lost focus with the GetFocus function.


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