Hyperlink Dialogs
- 4 minutes to read
The built-in Insert Hyperlink and Edit Hyperlink dialogs allow end-users to manage hyperlinks that can be inserted into a cell/cell range or associated with a floating container.
In addition to all options provided by the Insert Hyperlink, the Edit Hyperlink dialog has the option to remove the current hyperlink by clicking the “Remove Link” button. This option is identical to the “Remove Hyperlink…” item in context menus of the cells/cell ranges and floating containers that have an associated hyperlink.
If called, the ShowHyperlinkEditorDialog procedure implemented in the dxSpreadSheetEditHyperlinkDialog unit invokes either the Insert Hyperlink or Edit Hyperlink dialog, depending on the AHyperlink
parameter value.
To invoke the Insert Hyperlink dialog, an end-user can press the Ctrl+K key combination or click the “Hyperlink…” item in the cell selection or floating object context menu, respectively. If an existing hyperlink corresponds to the currently selected cell/cell range or floating container, clicking the “Edit Hyperlink…” context menu or pressing the Ctrl+K key combination invokes the Edit Hyperlink dialog.
As an additional option, you can provide the ShowHyperlinkEditor command to end-users by linking a custom UI element to a TdxSpreadSheetShowHyperlinkEditor action object within the TActionList.
Since the Spreadsheet control supports three reference types (including links to external resources, internal links, and links to e-mail addresses), both dialogs provide three corresponding reference creation/editing modes that an end-user can select by clicking a mode name or its icon:
Existing File or Web Page
Place in This Document
E-mail Address
Existing File or Web Page
This mode allows end-users to create or customize a hyperlink to an external resource, such as an existing file or a web page. Clicking the resulting link automatically starts the default web browser (if the hyperlink refers to a web address) or the default application that opens the corresponding file type (if the hyperlink refers to a file).
In this mode, the Insert Hyperlink and Edit Hyperlink dialogs display three fields:
The “Text to display:” field that corresponds to the hyperlink’s DisplayText property. This field, allowing an end-user to specify the anchor text for a hyperlink, is available in all dialog modes. Note that floating containers cannot display anchor text.
The “ScreenTip:” field that corresponds to the hyperlink’s ScreenTip property. This field, allowing an end-user to specify the screen tip for a hyperlink, is available in all dialog modes.
The “Address:” field that corresponds to the hyperlink’s Value property. This field contains the ellipsis button that invokes the additional Open dialog that allows an end-user to specify a file as the hyperlink’s target instead of a web address.
Place in This Document
This mode allows end-users to create or modify a hyperlink to a specific location within the same document. Clicking the resulting link activates the target worksheet and/or moves focus to the designated cell or cell range.
In addition to the “Text to display:” and “ScreenTip:” fields, in this mode the Insert Hyperlink and Edit Hyperlink dialogs provide the two following fields:
The “Type the cell reference:” field, allowing an end-user to specify the target cell or cell range.
The “Or select a place in this document:” tree view, allowing an end-user select a worksheet or defined name from the Cell Reference or Defined Names node, respectively.
The Cell Reference node within the “Or select a place in this document:” tree view is filled with all spreadsheet document worksheets. A cell or cell range to which the “Type the cell reference:” field value refers, is located in a worksheet currently selected within this node.
Since hyperlinks cannot refer to constants and expressions, the Defined Names node within the “Or select a place in this document:” tree view is filled with only those defined names that refer to a cell or cell range located anywhere within the same document. If a defined name is selected as the hyperlink target, the “Type the cell reference:” field value is ignored.
E-mail Address
This mode allows end-users to create or modify a hyperlink to the specified e-mail address. Clicking the resulting link automatically starts the default e-mail application and invokes its e-mail message creation window with prefilled To: and Subject: fields.
In addition to the “Text to display:” and “ScreenTip:” fields, in this mode the Insert Hyperlink and Edit Hyperlink dialogs provide the two following fields:
The “E-mail address:” field that allows an end-user to specify the target address of an automatically created e-mail message.
The “Subject:” field allows an end-user to specify the required subject of an automatically created e-mail message. Unlike “E-mail address:”, this field is optional.
A string specified in the “E-mail address:” field follows the dxEMailHyperlinkMailtoPrefix global constant in the hyperlink’s Value property value. If the “Subject:” field is not empty, both the dxEMailHyperlinkSubjectPrefix global constant and the field value are appended to the resulting e-mail address link.