Getting started: Creating a text document component

The Text Editing framework classes that work together to form editable text document components provide standard default behavior for all the basic aspects of text handling--text storage, presentation, selection, and modification. You can create a default editable text document component very easily by instantiating the default model, TTextModel, and the default presenter state, TTextPresenterState, and launching them in a compound document. To create an embeddable editable text document component, use the model class TEmbedderTextModel.

The simplest way to do this is to use the RunDocument AIX" utility with a stationery class, either TTextStationery or TEmbedderTextStationery. TTextStationery is a convenience class, provided by the Text Editing framework, that builds a document based on TTextModel and TTextPresenterState. TEmbedderTextStationery is a convenience class that builds an embeddable text document based on TEmbedderTextModel.


NOTE When you create your own Text Editing framework classes, you can create a similar stationery class by deriving from TCompoundDocumentStationery or from one of the other stationery classes provided by the Desktop frameworks.

TTextStationery and TEmbedderTextStationery access the shared library EditableTextLib. For example, to create a default text component based on TTextStationery named TextDoc, execute the following command from the AIX console:

    RunDocument -c -o TTextStationery EditableTextLib TextDoc
To create an embeddable text component, execute this command from the AIX console:

    RunDocument -c -o TEmbedderTextStationery EditableTextLib TextDoc
To create a text component without using RunDocument, instantiate the model and presenter state and use them to create a compound document. Your application will also need to create a window and provide an event handling loop.

      TTextModel* model = new TTextModel;
      TTextPresenterState* presenterState = new TTextPresenterState;
      TCompoundDocument textDocument( model, presenterState );

[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker