Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ PtTextSetSelection

Media Vault

Software Library

Restoration Projects

Artifacts Sought

PtTextSetSelection

[Previous] [Contents] [Index] [Next]

PtTextSetSelection()

Set the selected range for a PtText widget

Synopsis:

int PtTextSetSelection( PtWidget_t *widget, 
                        int *start, 
                        int *end );

Description:

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.

    Or:

  • 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 you move the text cursor (via arrow keys or a mouse click), the range is deselected nondestructively.
  • If you perform an action that would modify the widget's text in any way, the range is deleted and replaced by your input. If that input is Del or a delete backspace (DBS on many keyboards), the range is simply deleted.

Returns:

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.

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PtText, PtTextGetSelection()


[Previous] [Contents] [Index] [Next]

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026