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.
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 will return when you provide a pointer to any of the following parameters:
Both start and end are 0-based. So, for example, if start returns as 0, it indicates the first character in the widget's text buffer.
You could use this function to scroll to a specific line. For example, if you set Pt_ARG_CURSOR_POS 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).
Photon
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | No |
Thread | No |
PtTextGetSelection(), PtTextModifyText(), PtTextSetSelection(), PtMultiTextAttributes_t