Resources | developer.brewmp.com Resources | developer.brewmp.com

Developer

resources

Using text widget

To create a text widget, an application would do the following:

  1. Call ISHELL_CreateInstance() with a ClassID of AEECLSID_CTextWidget to create a text widget, as follows:
    ERR_TRY( ISHELL_CreateInstance(piShell, AEECLSID_CTextWidget,
                (void**)ppo) );
    ISHELL_CreateInstance() retrieves a reference counted instance of the class that manages the widget.
  2. Call IWidget_GetModel() to retrieve the text model associated with the text widget and populate this model with any existing text.
    if (AEE_SUCCESS == IWidget_GetModel(*ppo, AEEIID_TextModel,
                (IModel **) (void**) &pitm)) {
       ITextModel_SetSel(pitm, -1, -1);
       ERR_TRY( ITextModel_ReplaceSel(pitm, pwszText, -1));
       ERR_TRY( ITextModel_Release(pitm));
    }
  3. If the text widget is to contain multiple lines of text, call IWidget_SetFlags() with the TWF_MULTILINE flag set. For example:
    ERR_TRY( IWidget_SetFlags(*ppo, TWF_MULTILINE | TWF_VERTICALNAV));
  4. Call IWidget_SetExtent() to set the extent of the text widget, as follows:
    IWidget_SetExtent(piw, &we);