DocumentViewerPageLinksInteractiveMode Object

Summary

Provides support for using the mouse or touch to click on page links and invoke their targets.

Syntax

JavaScript Syntax
function lt.Documents.UI.DocumentViewerPageLinksInteractiveMode 
	extends lt.Controls.ImageViewerInteractiveMode 
TypeScript Syntax
class lt.Documents.UI.DocumentViewerPageLinksInteractiveMode() 
	extends lt.Controls.ImageViewerInteractiveMode 

Remarks

Page links are stored in each DocumentPage object in the current Document and can be obtained using the DocumentPage.GetLinks method.

Each link is of type DocumentLink that contain the LinkType property that specifies if the the target of the link is another location in the same page or document, or if the target is an external value (such as a hyperlink).

As well as the type, each link contains Bounds that specifies the location and size in the page in document coordinates.

In typical document viewing applications, the links should show an indication when the user hover over them with the mouse, such as changing the mouse cursor to a "hand". Also, when the user clicks on the link, the default action should invoked if possible, such as going to the target location specified by the link in the document.

This mode supports running links only when the user clicks over an item while pressing down a keyboard modifier through RunLinkKeyModifier. The default value is None. But can modify if needed - for example, set it to Control to mimic how Microsoft Word perform clicking on links embedded in a document.

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

DocumentViewerPageLinksInteractiveMode is an interactive mode that can handle the actions described above automatically. It will change the mouse cursor (when the platform supports them) to a "Hand" when the user hovers over the links and when the user clicks on them, it will inform the user and optionally invoke the action specified by the link automatically if the target was a location in the document.

This mode works as follows:

  • At any time, the mode uses the Bounds property of the links in the current page to determine if the mouse or touch event is on a link. If this is true, then it will set the IsHandled value to true. This allows this mode to work in cooperation with the other interactive modes currently in the view ImageViewer and is only activated when the user hovers over or clicks a link. Therefore, this mode is added by the DocumentViewer automatically upon creation. It is always enabled and the user does not have to switch it off for normal operations if links support is required. If this support is not needed, then this move can be either disabled (IsEnabled) or removed completely from the InteractiveModes list of ImageViewer.

  • Uses the Move event when the platform supports a mouse to track when the user hovers the cursor over a link. The Operation will fire with DocumentViewerOperation.HoverLink the DocumentLink object hovered over is in Data1. If the user moved the cursor out of any links, then the value of Data1 will be null. The operation will occur first with the value of IsPostOperation set to false and then true as usual. In all case, the interactive event data (InteractiveEventArgs) for the current mouse or touch move operation will be in Data2 to get the current cursor position if needed). This operation along with RunLinkKeyModifier allows application program to create rich user experience for links, such us showing the link value in a tooltip window with help on how to run the link similar to Microsoft Word or Adobe Acrobat.

  • Uses the DragStarted event to check if the user clicks the mouse or taps over a link bounds, when this occurs, the following happens:

  • The Operation will fire with DocumentViewerOperation.RunLink, the DocumentLink object being clicked in Data1 and the value of IsPostOperation to false. The user can intercept this event and set the value of Abort to true to indicate that the application handled this event and stops the mode from continuing to the next step. In all cases, the interactive event data (InteractiveEventArgs) for the current mouse or touch down operation will be in Data2 to get the current cursor position if needed).

  • If the user did not abort the action, this mode will check the value of LinkType. If the value is DocumentLinkType.TargetPage, then RunLinkTarget is called with Target. This will move the view to the specified page of the link and perform the fit and zoom percentage specified.

  • The Operation will fire again with the same parameters as before except that IsPostOperation is now true to indicate that the operation is completed.

Requirements

Target Platforms

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Documents.UI Assembly