SimpleTextAndMenus

SimpleTextAndMenus illustrates one mechanism you can use to enable 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 might expect, such as Undo, or Copy and Paste. This example also illustrates how to use the standard menu utility class TTextMenu.

Running the sample

Execute SimpleTextAndMenus. A window appears with some default text that you can edit. You can select text and apply style commands from the menu. Shift-clicking on selected text starts a text-dragging operation, and when you release the mouse the selected text is copied, and inserted into the new location. Close the window to exit.

Files and classes

SimpleTextAndMenusMain.C uses standard classes to present the text. A utility program creates a window for the view and starts event processing.

Notes

By default, TTextMenu adds all the text menus as submenus of the provided menu. Users wanting to customize this set can subclass TTextMenu.

You must call TMenu::SetControlLayout because it will not default for you. If you forget, the menu does not lay out properly.


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