TextEditor Object (ITextEditor Interface)

The TextEditor object is an ActiveX control that allows you to view and edit recognized text on a document page. A page is connected to the component via the FRPage property.

The Text Editor component looks like this:

You can modify the appearance of the component via its properties. For example, you can add buttons to its toolbar and remove them from it via the Toolbar property, or modify the context menu of the component via the Commands property. See Customizing the Context Menu and Toolbar of a Visual Component for details.

The information about editing the recognized text is reported through special outgoing interfaces. These interfaces are ITextEditorEvents (for C++) and a dispinterface DITextEditorEvents (for Visual Basic).

It's worth noting that Visual Basic users should not care for details of event interfaces implementation as this development platform provides easy means for handling them. This object may be declared WithEvents in Visual Basic.

For C++ user this fact means that it supports the IConnectionPointContainer interface. To receive notification events, a C++ user should create an object derived from the ITextEditorEvents interface, then set up the connection between it and events source implemented in TextEditor object by standard COM means.

The Text Editor component can be connected to the Component Synchronizer component, in which case all the events in Text Editor will be automatically transmitted to other components connected to the Synchronizer and the whole application will work synchronously.

Properties

Name Type Description
BottomPaneEnabled VARIANT_BOOL

Specifies whether the bottom pane of Text Editor is enabled. If this property is FALSE, bottom pane is not displayed.

By default, the value is TRUE.

CaptionPaneEnabled VARIANT_BOOL

Specifies whether the caption pane of Text Editor is enabled. If this property is FALSE, caption pane is not displayed.

By default, the value is TRUE.

ContextMenuEnabled VARIANT_BOOL

Specifies whether the context menu of Text Editor is enabled. If this property is FALSE, context menu is never displayed.

By default, the value is TRUE.

Commands Commands, read-only Provides access to the commands available in Text Editor. See the list of commands available in Text Editor.
CursorPosition EditorPosition Specifies the cursor position on the page.
FRPage FRPage Represents the document page connected to Text Editor.
KeepTextAndBackgroundColor VARIANT_BOOL

Specifies whether text and background colors should be retained in Text Editor.

By default, the value of this property is TRUE.

Locked VARIANT_BOOL

Specifies whether Text Editor is locked.

This property is useful in the following situations:

  • analysis, recognition, synthesis, or export operation is called from FineReader Engine API (not from Visual Components), or
  • your application receives notifications of certain events (e.g., from the FRDocument object) and processes Windows messages from Visual Components in these events handlers.

In this case, we recommend that you set this property to TRUE before analysis, recognition, synthesis or export, and set it to FALSE after the end of the operation. In this case, the document cannot be spoilt from Text Editor.

By default, the value is FALSE.

Mode TextEditorModeEnum

Specifies one of the document viewing modes.

By default, the value is TEM_ExactCopy.

PopupMenu PopupMenu, read-only Provides access to the settings of the context menu.
SettingsPath BSTR

Specifies the path to the folder which contains files with the settings of Text Editor. Other Visual Components have the same property. Each Visual Component should use its own folder with settings.

The value of this property is constructed from the path to the folder, in which ABBYY FineReader Engine stores user-specific data, and the name of its subfolder. By default, the folder with user-specific data is the FineReader Engine data folder. It can be changed during initialization of FineReader Engine (via the InitializeEngine function, or via the IEngineLoader::InitializeEngine method). The default name of the subfolder is an arbitrary GUID. To change the name of the subfolder, you should specify the new name in the properties of the component in Visual Studio at design time. If you try to specify the value of the property at run time, this value is ignored.

If you add the component to a form in Visual Studio when designing, the value of the property is defined either automatically with the default value, or manually with a custom value. In both cases the value is defined at design time. If for some reason the value of the property is not defined at design time (e.g., if you generate the component dynamically at run time), the component creates a new folder with the settings each time the component is initialized. To avoid multiplication of the folders, you should delete the created settings folder after the component deinitialization. In this case, you can use only the default settings of the component and cannot save the settings between sessions.

ShowPictures VARIANT_BOOL

Specifies whether pictures should be displayed in Text Editor.

By default, the value of this property is TRUE.

ShowRunningTitles VARIANT_BOOL

Specifies whether running titles should be displayed in Text Editor.

By default, the value of this property is TRUE.

SynthesisParamsForDocument SynthesisParamsForDocument

Specifies the default synthesis parameters for a document. These parameters are used if Text Editor needs to perform document synthesis (this may happen if the logical structure of a document becomes incorrect due to some editing operations).

Note: If Text Editor is connected to Component Synchronizer, use the IComponentSynchronizer::ProcessingParams property to change parameters used for document synthesis. If you change these parameters via the property of Text Editor, errors may occur.

SymbolRect FRRectangle, read-only Stores the coordinates of the current character rectangle in pixels. The coordinates are relative to the document image.
Title BSTR

Specifies the title of the Text Editor component.

By default, it is "Text".

Toolbar Toolbar, read-only Provides access to the toolbar settings.
ViewScale int

Specifies the scale of the text page in percentage points. This property can be also set to one of the ScaleTypes constants.

By default, the value is ST_BestFit, which means that the best fit is automatically selected.

VisibleDocumentArea FRRectangle, read-only Stores the coordinates of the visible document area in pixels. The coordinates are relative to the document image.
WindowHandle __int64, read-only Returns the window handle of the client area.

Methods

Name Description
ActivateOn Activates a position in the specified block and moves it into view.
CenterOnDocumentPoint Scrolls text view so that the specified document point is positioned at the center of the view.
DocumentToScreen Converts coordinates of the specified point on the document image into screen coordinates.
GetSelection Returns the beginning and the end cursor position of the selection.
Print Prints recognized text.
SetSelection Sets text selection on a page.
ScreenToDocument Converts screen coordinates of the specified point into coordinates on the document image.
ShowBlock Moves the specified block into view (as far as possible). This method makes sense only if Text Editor is used in the TEM_ExactCopy mode.
ShowDocumentArea Scrolls text view so that the document area with the specified coordinates becomes visible (as far as possible).
UpdateOptions Updates the settings specified in the Options dialog box of Text Editor. You may need to call this method, if the options have been changed in some other Visual Component, to update the options of Text Editor to the current state.

Samples

This component is used in the following code samples: VisualComponents.

See also

ITextEditorEvents

IComponentSynchronizer::TextEditor

Creating an Application with a Graphical User Interface

Customizing the Context Menu and Toolbar of a Visual Component

9/17/2024 3:14:40 PM

Usage of Cookies. In order to optimize the website functionality and improve your online experience ABBYY uses cookies. You agree to the usage of cookies when you continue using this site. Further details can be found in our Privacy Notice.