Creating your own text class

If you want to implement your own text storage mechanism, you can derive your own class from TText. Your class must:

See the TText.h file and the online class and member function documentation for a complete list of virtual functions and their descriptions.

Note that you should not override the TText Insert, Delete, or Replace functions. Instead, you implement protected functions that are broken down to handle the operations on character and style data separately, as shown in this figure:


The HandleInsertCharacterGap and HandleInsertStylesGap functions should be implemented to manipulate storage as necessary so that character or style data can be copied into the text object.

The TText Insert, Delete, and Replace functions are implemented to call the protected functions as follows:

Insert makes the following calls:

  1. HandleInsertCharacterGap
  2. HandleCopyCharacters
  3. HandleInsertStylesGap
  4. HandleCopyStyles--when the text to insert is a text object and not a UniChar array
Delete makes the following calls:

  1. HandleDeleteStyles
  2. HandleDeleteCharacters
Replace makes the following calls:

  1. HandleDeleteStyles
  2. HandleInsertCharacterGap--when the text to insert is longer than the text being replaced; or
    HandleDeleteCharacters--when the text to insert is shorter than the text being replaced
  3. HandleCopyCharacters
  4. HandleInsertStylesGap
  5. HandleCopyStyles-- when the replacement text is a text object and not a UniChar array

[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