TextEditing
The Text Editing samples illustrate how to use the Text
Editing framework to enable users to edit text data. For
information on basic text operations, see Text. The following
paragraphs briefly describe each Text Editing sample.
SimpleTextAndMenus illustrates one mechanism you can use to allow
users to edit text, using TSimpleTextStore and TSimpleTextView. These
classes are independent of the Document framework, and thus
lightweight and easier to manage. They support standard user
interface operations such as typing, deleting, selecting, and drag and
drop. However, since this technique does not use the Document
framework, it does not automatically provide users with additional
features they may expect, such as undo, or copy and paste. This
example also illustrates use of the standard menu utility class
TTextMenu.
PresFrmwkText illustrates how to use TTextModel and
TTextPresenterState with the Compound Document and Presentation
frameworks to provide more features than are available with simple
text. It subclasses TDocumentComponentStationery to provide a
stationery class that uses TTextModel and a custom subclass of
TTextPresenterState. A script that invokes RunDocument is provided as
well.
CustomTextCommand shows you how to write a subclass of a text
command, in this case TReplaceTextCommand, and put your command into a
menu. It overrides TReplaceTextCommand::HandleDoBegin to compute
replacement text for the currently selected text. It also illustrates
one way to use TTextChunkIterator.
CustomTextTool shows you how to write a text tool and interactor,
and to use menus and the Cursor Tools framework to use this new tool.
The tool here is closely modeled on the EditableText class
TSimpleTextTool.
CustomTextSelector shows how to write a text selection interactor
and have a subclass of TTextView use that interactor. The interactor
here is very different from TSelectTextInteractor, but uses the same
utility classes to perform its work.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.