Developer

API Reference

ITextModel_SetSel()

Brew Release
Brew MP 1.0.2
See Also
- Model Events
- TextInfo
- ITextModel
- ITextModel_GetSelText
Description
This function sets the current start and end position for the selection range stored in the text model.
Parameters
  • pif
    []:
    Pointer to the ITextModel interface object.
  • nSelStart
    []:
    Indicates the position of the start of the text selection.
  • nSelEnd
    []:
    Indicates the position of the end of the text selection.
Interface
Prototype
   void ITextModel_SetSel(ITextModel *pif, int nSelStart, int nSelEnd); 
Return
None
Side Effect
Changing the selection range stored in a text model by calling ITextModel_SetSel() will cause BREW to send an EVT_MDL_TEXT_SELECT ModelEvent to any object that has registered as a listener with the model.
The fields of the ModelEvent will contain the following information.
       dwParam:  The position of the start of the text selection range, after the
                 call to ITextModel_SetSel().
Comment
Both nSelStart and nSelEnd are zero based. Specify (-1) to indicate 'end of text'. Therefore, to select the entire text call ITextModel_SetSel(po, 0, -1). To set the selection to the end of the text call ITextModel_SetSel(po, -1, -1). The latter will cause ITextModel_ReplaceSel() to append text to the end of the text model.
   To illustrate, if 'nSelStart' is set to 9 and 'nSelEnd' is set to 11,
   the selection will displayed as shown below.
                                              1   1   1   1   1   1   1   1   1   1
      0   1   2   3   4   5   6   7   8   9   0   1   2   3   4   5   6   7   8   9
       ---------------------------------------------------------------------------
      | A | s | t | r | o | b | o | y |   | i | s |   | a |   | r | o | b | o | t |
       ---------------------------------------------------------------------------
                                          ^       ^
                                        start    end

  • Follow