←Select platform

DocumentViewerSelectTextInteractiveMode Class

Summary

Provides support for using the mouse or touch to select text in the document viewer.

Syntax
C#
C++/CLI
public class DocumentViewerSelectTextInteractiveMode : ImageViewerRubberBandInteractiveMode 
public: 
   ref class DocumentViewerSelectTextInteractiveMode : ImageViewerRubberBandInteractiveMode 
Remarks

The text of each page are stored in the DocumentPage object in the current LEADDocument and can be obtained using the DocumentPage.GetText method.

When this DocumentViewer is created, An instance of DocumentViewerSelectTextInteractiveMode is initialized and added to the InteractiveModes list of the ImageViewer of the View.

This mode can be enabled using the InteractiveSelectText command.

When this mode is active, it will perform hit-testing using the page text object stored in Text and will update the selection status by calling SetSelectedTextItems.

The RenderSelection (true by default) is used to highlight the text selection on the view. Hence, when this mode is selecting and un-selecting text based on the user action, the view is updated to reflect the selection status. This performed "live" as the user clicks and drags on the view.

Note that this mode calls GetDocumentPageText, hence the rules on how the text is obtained is controlled by the value of AutoGetText as usual.

The mode derives from ImageViewerRubberBandInteractiveMode and only supports ImageViewerRubberBandShape.Rectangle. It works as follows by default:

When the user clicks and draws the rubber band selection rectangle on a page that has text, hit-testing is performed to detect the characters that are included inside this rectangle. SetSelectedTextItems is called to add these characters to the current selection. This is performed "live" and the selection is updated as the user draws the selection rectangle and the view is updated instantly.

The values of LineKeyModifier, WordKeyModifier and CharacterKeyModifier control if the containing line or word of the character is also selected. By default, the values are set to None, Alt and Control respectively. This means when the user draws the selection rectangle without any modifiers, the whole line is selected when any of its characters is inside the rectangle. When Alt is pressed while the selection rectangle is draw; the whole word is selected when any of its characters is inside the rectangle and when Control is pressed; individual characters are selected without their containing words or lines.

This is the common behavior used by popular text editor applications. It can be changed by using the properties above or disable character/word selection all together by setting the values to None since LineKeyModifier is always checked first and any other modifier with the same value will be ignored.

Requirements

Target Platforms

Help Version 22.0.2023.1.30
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Document.Viewer.WinForms Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.