get_hyperlink();
set_hyperlink(value);
Object.defineProperty('hyperlink');
Type | Description |
---|---|
string | The hyperlink for this AnnObject. The default value is null. |
The hyperlink of an object can be any string value or null. It is up to the user's application to determine how to use this value.
This example will create two annotation objects with hyperlinks and add them to a container, switches to run mode and run the hyperlink when the object is clicked.
example: function SiteLibrary_DefaultPage$example() { var inch = 720.0; // Get the container var container = this._automation.get_container(); // Add a red on green rectangle from 1in 1in to 2in 2in var rectObj = new lt.Annotations.Core.AnnRectangleObject(); rectObj.set_rect(lt.LeadRectD.create(1 * inch, 1 * inch, 1 * inch, 1 * inch)); rectObj.set_stroke(lt.Annotations.Core.AnnStroke.create(lt.Annotations.Core.AnnSolidColorBrush.create("red"), lt.LeadLengthD.create(1))); rectObj.set_fill(lt.Annotations.Core.AnnSolidColorBrush.create("green")); // Set its hyperlink rectObj.set_hyperlink("http://www.leadtools.com"); // Add it to the container container.get_children().add(rectObj); // Add a blue on yellow rectangle from 3in 3in to 4in 4in var rectObj = new lt.Annotations.Core.AnnRectangleObject(); rectObj.set_rect(lt.LeadRectD.create(3 * inch, 3 * inch, 1 * inch, 1 * inch)); rectObj.set_stroke(lt.Annotations.Core.AnnStroke.create(lt.Annotations.Core.AnnSolidColorBrush.create("blue"), lt.LeadLengthD.create(1))); rectObj.set_fill(lt.Annotations.Core.AnnSolidColorBrush.create("yellow")); rectObj.set_hyperlink("http://www.leadtools.com/downloads/demos.htm"); // Add it to the container container.get_children().add(rectObj); // Subscribe to the Run event of the automation this._automation.add_run(function(sender, e) { // e is of type AnnRunDesignerEventArgs // Check for status == End if (e.get_operationStatus() == lt.Annotations.Core.AnnDesignerOperationStatus.end) { // Get the annotation object var annObj = e.get_object(); // Get its hyperlink string var hyperlink = annObj.get_hyperlink(); // Browse to it if(hyperlink != "" && hyperlink != null) { alert("Opening\n" + hyperlink); var winObj = window.open(hyperlink); if (winObj == null || typeof winObj == 'undefined') { alert("Your Popup Blocker has blocked saving the annotation file to your disk. Disable the Popup Blocker for this web site and try again."); } } } }); // Switch to run mode this._automation.get_manager().set_userMode(lt.Annotations.Core.AnnUserMode.run); alert("Run mode, click on the rectangles to go to their hyperlinks"); },