QNX Community Resources
Set the selected range for a PtText widget
int PtTextSetSelection( PtWidget_t *widget, int *start, int *end );
This function sets the selected range for a PtText. When the function completes successfully, start and end contain the range actually selected (start < end). These values may differ from the original values you specified if:
- The start value you specified was
greater than end.
- The range you specified exceeded the bounds of the widget's text.
Both start and end are 0-based. So, for example, if start is 0, it indicates the first character in the widget's text buffer.
This function causes a nondestructive deselect of the currently selected range, if there is one.
Here's how a selected range behaves:
- If the user moves the text cursor (via arrow keys or a mouse click), the range is deselected nondestructively.
- If the user performs an action that would modify the widget's text in any way, the range is deleted and replaced by the user's input. If that input is Del or a delete backspace (DBS on many keyboards), the range is simply deleted.
The number of characters successfully selected (which may be 0 if *start equals *end or if *start and *end are both greater than the number of characters in the widget), or -1 if the specified widget isn't a PtText widget.