Get the selected range from a PtText widget
int PtTextGetSelection( PtWidget_t *widget, int *start, int *end );
This function gets the currently selected range from a PtText widget. It returns the number of characters currently selected and sets the provided integers to the actual range. All characters from start up to but not including end are currently selected.
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.
The number of characters currently selected, or -1 if the specified widget isn't a PtText widget.