PtTextModifyText()
Modify the contents of a PtText widget
Synopsis:
int PtTextModifyText( PtWidget_t *widget,
int start,
int end,
int insert_pos,
char const *text,
int length );
Description:
This function modifies the contents of a PtText widget.
If start doesn't equal end, then:
- All characters from start up to, but not including, end are deleted.
- The widget's current insert position is set to the lesser of start and end.
- The insert_pos argument is ignored.
If start does equal end, then:
- No text is deleted.
- The widget's current insert position is set to insert_pos; if insert_pos equals -1, the current insert position is set to the end of the widget's text buffer.
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.
Once the current insert position is set, the function inserts length characters from text. It does this regardless of the widget's insert mode. If length is zero, no text is inserted.
This function causes a nondestructive deselect before attempting the changes. If the widget has the Pt_CALLBACKS_ACTIVE bit set in its Pt_ARG_FLAGS resource, it then invokes its Pt_CB_MODIFY_VERIFY callbacks, if any. These callbacks might do one of the following:
- Cause the changes to be discarded.
Or:
- Modify the text to be inserted and/or deleted before this function applies the changes.
If this call results in a change to the widget's text (and Pt_CALLBACKS_ACTIVE is set), the widget will invoke its Pt_CB_MODIFY_NOTIFY / Pt_CB_TEXT_CHANGED callbacks, if any.
Returns:
- 1
- The widget's text was changed.
- 0
- No change occurred.
- -1
- The widget is NULL or isn't a PtText widget.
Classification:
Photon
| Safety: | |
|---|---|
| Interrupt handler | No |
| Signal handler | No |
| Thread | No |
