TE Edit Control Win32 / Win64 Help
Product page

CTerView Class Interface

The CTerView class interface is provide by the TER_VIEW.H and TER_VIEW.CPP files. Your application module that uses the CTerView class object should include the TER_VIEW.H file. Your application project should include the TER_VIEW.CPP and TER.LIB files. Also the TER.DLL file must be available in the current directory or a directory included in the path statement.

CTerView is a class derived from the CView class provided by Microsoft's MFC library. Your application can add the CTerView class or a class derived from CTerView to the document template.

The CTerView class provides the menu handlers for each menu option. The command ids for the menu handlers are defined in the TER_VIEW.RCH file. You can use the Visual C++ Application Studio to connect these menu ids to the menu option in your application frame window. For Application Studio to recognize these symbols, the TER_VIEW.RCH file must be specified as a read only symbol file. Select the 'Set Include' option from the 'File' menu in Application Studio and add the TER_VIEW.RCH file to the list of 'Read Only Symbol Directive' list box.

Your application can communicate with the editor control using the class member functions as well as the DLL functions described in the 'Application Interface Functions'. The class member functions provide rudimentary functionality similar to the Microsoft's CView class functions. The DLL functions should be used for additional manipulation of the control data.

Class Member Functions:

CTerView:Constructor.
EditStyles:Returns the default editor window styles which are used to create the control window.
DeleteContents:Delete the current contents of the edit control.
MenuEnable:Returns TRUE if a menu item should be enabled.
MenuSelect:Returns TRUE if a menu item should be checked.
OnXXXXHandlers for the menu commands
OnUpdateXXXXUpdate handlers for the menu commands
Serialize:Save the contents of the control to the archive.
SerializeRaw:Save the contents of the control to the standalone archive file.
TerMenu:Execute an editor menu command.

Class Member Function Description

CTerView:

Initialize internal variables.

CTerView();

EditStyles:

Returns the editor attribute bits.

WORD EditStyles();

Remarks: This function is called by the 'CTerView::PreCreateWindow' function to modify the editor window style bits. By default, the function returns TER_WORD_WRAP, TER_VSCROLL, and TER_BORDER_MARGIN styles. You can override this function to provide other styles. Please refer to the 'Create Window' section in the 'Getting Started' chapter for a list of control style constants

DeleteContents:

Delete the entire contents of the edit control.

void DeleteContents();

Remarks: This function clears the contents of the edit control by assigning it an empty buffer.

MenuEnable:

Returns TRUE if a menu item should be enabled.

BOOL MenuEnable(MenuItem);

int MenuItem: // menu item number to test. The MenuItem can be one of the constants defined in the TER_CMD.H file.

Remarks: This function is called internally to enable or disable a menu option in an OnUpdateXXXX type handler.

Return Value: This function returns TRUE if the menu option is to be enabled.

See Also: MenuSelect(), TerMenu()

MenuSelect:

Returns TRUE if a menu item should be checked.

BOOL MenuSelect(MenuItem);

int MenuItem: // menu item number to test. The MenuItem can be one of the constants defined in the TER_CMD.H file.

Remarks: This function is called internally to 'check' a menu option in an OnUpdateXXXX type handler.

Return Value: This function returns TRUE if the menu option is to be checked.

See Also: MenuEnable(), TerMenu()

OnXXXX

OnUpdateXXXX

These functions provide the handlers for each menu option that your application's frame window can incorporate to allow the user to interact with the editor. The menu item ids are defined in the TER_VIEW.RCH file. This file must be included in the Application Studio's ReadOnly Symbol Directives. The following is a brief description of each id:

TID_LINE_BEGIN Position at the beginning of the line
TID_LINE_END Position at the end of the line
TID_FILE_BEGIN Position at the beginning of the file
TID_FILE_END Position at the end of the file
TID_INS_AFT Insert a line after the current line
(non-wordwrap mode only)
TID_INS_BEF Insert a line after the current line
(non-wordwrap mode only)
TID_DEL_LINE Delete the current line
TID_SPLIT_LINE Split the current line (non-wordwrap
mode only)
TID_JOIN_LINE Append the line at the end of the
current line (non-wordwrap mode only)
TID_NEXT_WORD Position at the next word
TID_PREV_WORD Position at the previous word
TID_HILIGHT_LINE Highlight a line block (non-wordwrap
mode only)
TID_BLOCK_COPY Copy a block (non-wordwrap mode only)
TID_BLOCK_MOVE Move a block (non-wordwrap mode only)
TID_SELECT_ALL Select the entire document
TID_CUT Cut the selected block to the clipboard
TID_COPY Copy the selected block to the clipboard
TID_PASTE Paste text from the clipboard
TID_PASTE_SPEC Paste OLE objects from the clipboard
TID_PICT_FROM_FILE Import a picture from a bitmap file
TID_SEARCH Search a text string
TID_SEARCH_FOR Find the next occurrence of the text
string
TID_SEARCH_BACK Find the previous occurrence of the
text string
TID_REPLACE Replace a text string with another text
string
TID_HELP Show the editor help window
TID_UNDO Undo the previous edit operation
TID_INSERT Toggle the insert/overtype mode
TID_INSERT_DRAW_OBJECT Insert a drawing object
TID_INSERT_OBJECT Insert an object into text
TID_INSERT_PAGE_NUMBER Insert the page number string
TID_INSERT_PARA_FRAME Insert a text frame
TID_PRINT Print the document to the current
printer
TID_PRINT_PREVIEW Print preview
TID_PAGE_OPTIONS Edit page setup options
TID_JUMP Jump to a specified line number
TID_CHAR_NORMAL Reset all character styles
TID_BOLD_ON Toggle bold character style
TID_ULINE_ON Toggle underline character style
TID_ITALIC_ON Toggle italic character style
TID_STRIKE_ON Toggle strikethrough character style
TID_SUPSCR_ON Toggle superscript character style
TID_SUBSCR_ON Toggle subscript character style
TID_COLOR Choose text foreground color
TID_BK_COLOR Choose text background color
TID_FONTS Choose text font
TID_PARA_NORMAL Reset all paragraph styles
TID_CENTER Center the current paragraph
TID_RIGHT_JUSTIFY Right justify the current paragraph
TID_JUSTIFY Paragraph justification on both edges.
TID_LEFT_INDENT Left indent the current paragraph
TID_RIGHT_INDENT Right indent the current paragraph
TID_DOUBLE_SPACE Double space the current paragraph
TID_HANGING_INDENT Create hanging indents for the current
paragraph
TID_TAB_CLEAR Clear a tab position for a paragraph
TID_TAB_CLEAR_ALL Clear all tab positions for a paragraph
TID_PAGE_BREAK Insert a page break
TID_PARA_KEEP Paragraph keep together
TID_PARA_KEEP_NEXT Paragraph keep with next
TID_REPAGINATE Repaginate now
TID_SECT_BREAK Insert a section break
TID_SECT_OPTIONS Edit section options
TID_FITTED_VIEW Toggle fitted view
TID_COL_BREAK Insert a column break
TID_RULER Toggle the ruler display
TID_TOOL_BAR Toggle the toolbar display (use the
framework toolbar instead)
TID_STATUS_RIBBON Toggle the status ribbon display (use
the framework status ribbon instead)
TID_SHOW_HYPERLINK_CURSOR Toggle the display of hyperlink
cursor.
TID_EDIT_PICT Edit picture size
TID_SHOW_HIDDEN Show hidden text
TID_HIDDEN_ON Toggle hidden character attribute
TID_ULINED_ON Toggle double underline character
attribute
TID_PROTECT_ON Toggle protect character attribute
TID_PROTECTION_LOCK Toggle protection lock for the document
TID_PARA_BORDER Edit paragraph borders
TID_SHOW_PARA_MARK Toggle the display of paragraph markers.
TID_INSERT_OBJECT Insert an OLE object from a file
TID_TABLE_INSERT Insert a new table
TID_TABLE_INESRT_ROW Insert a table row
TID_TABLE_SPLIT_CELL Split current table cell
TID_TABLE_MERGE_CELLS Merge selected table cells
TID_TABLE_DEL_CELLS Delete table cells
TID_TABLE_ROW_POS Table row positioning
TID_TABLE_CELL_BORDER Edit cell border
TID_TABLE_CELL_SHADE Edit cell shading
TID_TABLE_SHOW_GRID Show table grid lines

Serialize:

Save the contents of the control to the archive.

void Serialize(ar);

CArchive &ar; // archive object reference

Remarks: This function retrieves and stores the control data from the archive file. The text is preceded by a 4 byte header block that stores the length of the control data buffer.

See Also: SerializeRaw()

SerializeRaw:

Save the contents of the control to the standalone archive file.

void SerializeRaw(ar);

CArchive &ar; // archive object reference

Remarks: This function retrieves and stores the control data from the archive file. Unlike the 'Serialize' function, this function does not use a header block. The archive file is expected to be a standalone file.

See Also: Serialize()

TerMenu:

Execute an editor menu command.

void TerMenu(MenuItem)

int MenuItem: // menu item number to test. The MenuItem can be one of the constants defined in the TER_CMD.H file.

Remarks: This function is called internally to call the DLL menu handler for an OnXXXX type handler implementation.

See Also: MenuEnable(), MenuSelect()