The HotLink command allows you to launch a URL or file associated with an active object by clicking on the object or its label. The HotLink command is available for Map windows containing at least one active layer. A layer is active if it is selectable or editable and its HotLink options have been set (in particular the Filename Expression).
To launch a URL or filename using the HotLink command:
- On the MAP tab, in the Options group, click Map Tools, and click Hotlink. When the cursor is positioned over an active object, the cursor changes. Note: The link associated with the active object displays in the Status Bar.
- Click the object or label to launch the associated URL or file. If multiple objects exist under the point where you click, a pop-up window appears containing a list of the selectable objects. Choose the object whose link you want to activate.
Adding URL Information to Your Table
You can create active objects for your existing table by adding URL-specific data to your table.
To add URL information to an existing table:
- On the Table tab, in the Maintenance group, click Table, and Modify Structure to open the View/Modify Table Structure dialog box.
- Choose Add Field. Add a character field to contain the active object text. Make the length of the field long enough for the active object text, and name the field.
- Click OK to complete the field addition.
- Open the table in a Browser window (on the HOME tab, in the Windows group, click New Document, and click Browser from the list).
- Enter the appropriate file link text in the new field for each row in the table.
Now that your table contains the active objects, you need to set the HotLink options for the table.
Example-Putting States URLs on a Map
In this example, we demonstrate how to add active objects to a map for each region in the map. In the United States, each state has a web site that provides a wide range of information about the specific state. In this example, we place these state URLs on a map that might be used on a national web site. You can modify this process based on your own needs.
To create an active object for each region on a map:
- Display the map containing the active objects as a map.
- On the HOME tab, in the Windows group, click Tool Windows, and click Layers from the layers, to open the Layers window. Select the layer that contains the active objects.
This enables the HotLink Options command.
- On the MAP tab, in the Options group, click HotLink Options to open the HotLink Options dialog box.
- Choose the Filename Expression from the drop-down list and do one of the following:
- Find the field name that holds the link information
- Use an expression that concatenates two or more fields to define the file link. For example, in a map of the United States, you can use this expression:
http://www." + State_Name + ".com
Note: To add the table path to the filename before launching it, check the file locations are relative to table location.
- (Optional) Choose the Alias Expression from the drop-down list and do one of the following:
- Find the field name that holds the link alias information
- Use an expression that concatenates two or more fields to define the alias.
- In the Activate on group, choose the active object location for the launch when the user clicks the object with the HotLink command (located on the MAP tab, in the Options group, Map Tools dropdown). Choose:
- Labels - to launch the active object when you click the HotLink command on an object's label.
- Objects - to launch the active object when you click the HotLink command on an object.
- Labels & Objects - to launch the active object when you click the HotLink command on either an object or its label.
- Check the Save options to metadata box to save the HotLink options to the table's metadata.
- Click OK.
Adding the Path to the Filename
If you want MapInfo Pro to add the table path to filenames before launching them, check the File locations are relative to table location box. This is useful if you are distributing tables containing HotLinks to files located in the same directory. Regardless of where the data is installed, the HotLinks will work. If the box is not checked, MapInfo Pro launches the file without modifying the name.
Saving HotLink Options to Metadata
Check the Save options to table metadata box to save the HotLink options to the table's metadata. Every time you open the table, the HotLink options will be restored. This check box is not available if the table is read only or if metadata operations are not supported on the table type, for example, Street Works tables. If you do not check the box, the HotLink settings will be lost when you close the table, unless you save your session to a workspace.
The settings are added to the .TAB file in the Metadata area. The syntax for the HotLink settings is:
"\ActiveObject" = ""
"\ActiveObject\Expr" = (where the field or expression is stored)
"\ActiveObject\Mode" = (type of object from which to launch active object)
Entries can be one of the following:
"HOTLINK_MODE_OBJ"
"HOTLINK_MODE_LABEL"
"HOTLINK_MODE_BOTH"
"\ActiveObject\Relative" = (relative to path)
Entries can be one of the following:
"TRUE"
"FALSE"
Using the HotLink Command in Browser Windows
If you have saved the HotLink options to the table's metadata, then you can also use the HotLink command in the Browser window. Just click the HotLink command to activate it (located on the MAP tab, in the Analyze group), move the cursor to the field you have set up for your active objects, and click any of the links.
When you open a new Browser window, MapInfo Pro reads the table's metadata to determine if the HotLink filename expression matches any of the Browser's field expressions. If so, the text in that field is underlined, to indicate an active object. The HotLink command will be available for that Browser window and you can select links from it.
If the HotLink filename expression is not a table column name, you can create a HotLink field in the Pick Fields dialog box, using the HotLink filename expression as the field expression. You cannot edit data in a Browser window while the HotLink command is active, but you can select rows and move or resize Browser fields.