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

Syntax 2 For DataWindows with RichTextEdit presentation styles – PB Docs 125 – PowerBuilder Library

Syntax 2 For DataWindows with RichTextEdit presentation styles – PB Docs 125

Syntax 2 For DataWindows with RichTextEdit presentation styles

Description

Determines the line and column position of the insertion point
or the start and end of selected text in a RichTextEdit control.

Controls

DataWindow type

Method applies to

PowerBuilder

DataWindow control

Syntax

[PowerBuilder]

Argument

Description

rtename

A reference to a DataWindow control.
The DataWindow object in the DataWindow control must be a RichTextEdit DataWindow.

fromline

A variable in which you want to save
the number of the line where the insertion point or the start of
the selection is.

fromchar

A variable in which you want to save
the number in the line of the first character in the selection or
after the insertion point.

toline (optional)

A variable in which you want to save
the number of the line where the selection ends.

tochar (optional)

A variable in which you want to save
the number in the line of the character before which the selection
ends.

Return Values

Returns the band containing the selection or insertion point.
The returned value is a value of the Band enumerated datatype (Detail!,
Header!, or Footer!).

Usage

Position reports the position of the insertion
point if you omit the toline and tochar arguments.
If text is selected, the insertion point can be at the beginning
or the end of the selection. For example, if the user dragged down
to select text, the insertion point is at the end.

If there is a selection, a character argument can be set to
0 to indicate that the selection begins or ends at the start of
a line, with nothing else selected on that line. When the user drags
up, the selection can begin at the start of a line and fromchar is
set to 0. When the user drags down, the selection can end at the
beginning of a line and tochar is set to 0.

Selection or insertion point

To find out whether there is a selection or just an insertion
point, specify all four arguments. If toline and tochar are set
to 0, then there is no selection, only an insertion point. If there
is a selection and you want the position of the insertion point,
you will have to call Position again with only
two arguments. This difference is described next.

The position of the insertion point and end of selection can differ

When reporting the position of selected text, the positions
are inclusive—Position reports the first
line and character and the last line and character that are selected.
When reporting the position of the insertion point, Position identifies
the character just after the insertion point. Therefore, if text
is selected and the insertion point is at the end, the values for
the insertion point and the end of the selection differ.

To illustrate, suppose the first four characters in line 1
are selected and the insertion point is at the end. If you request
the position of the insertion point:

Then:

  • ll_line is
    set to 1

  • ll_char is set to 5, the character following
    the insertion point

If you request the position of the selection:

  • ll_startline
    and ll_startchar are both set to 1

  • ll_endline is 1 and ll_endchar
    is set to 4, the last character in 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,
0 is not a valid character position when selecting text, although
it is meaningful in describing the selection.

Examples

This example calls Position to
get the band and the line and column values for the beginning and
end of the selection. The values are converted to strings and displayed
in the StaticText st_status:

This example extends the current selection down 1
line. It takes into account whether there is an insertion point
or a selection, whether the insertion point is at the beginning
or end of the selection, and whether the selection ends at the beginning
of a line:

For an example of selecting each word in a RichTextEdit control,
see SelectTextWord.

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