Caution: This version of this document is no longer maintained. For the latest documentation, see


Get character or line information from a PtMultiText widget


int PtMultiTextInfo( PtWidget_t *widget,
                     int query_type,
                     int *char_offset,
                     int *line_num,
                     PtMultiTextLine_t *line,
                     int *start,
                     int *end,
                     int *length,
                     PtMultiTextSegment_t *seg,
                     PtMultiTextAttributes_t *attrs);


This function gets information about a character or line within a PtMultiText widget.

Using the information returned in the provided integers and in the PtMultiTextLine_t, PtMultiTextSegment_t, and PtMultiTextAttributes_t structures, you can determine:

Any argument representing information that you don't require can be set to NULL. Any argument representing information you do require must point to an instance of the integers or structures of the appropriate type. The data returned is copied from the widget's internal structures into the structures provided.

Note: The returned data may not remain valid for very long, so you should use it immediately!

If you set query_type to Pt_MT_QUERY_LINE, then:

If you set query_type to Pt_MT_QUERY_CHAR, then:

Here's what the function fills in when you provide a pointer to any of the following parameters:

The number of the line found by the query.
The line structure for that line.
The character offset of the first character in the line.
The character offset of the last character in the line.

Both start and end are 0-based. So, for example, if *start is set to 0, it indicates the first character in the widget's text buffer.

The number of characters in the line.
The segment that contains char_offset.

You could use this function to scroll to a specific line. For example, if you set Pt_ARG_CURSOR_POSITION to the offset of a character on line 35, the widget will scroll to line 35. (The PtMultiText widget will scroll as necessary, horizontally and vertically, to make the cursor visible).


The provided widget is NULL or isn't a PtMultiText widget.



Interrupt handler No
Signal handler No
Thread No

See also:

PtTextGetSelection(), PtTextModifyText(), PtTextSetSelection(), PtMultiTextAttributes_t, PtMultiTextLine_t, PtMultiTextSegment_t