A recent question in the newsgroups has set me looking at the way in which Visio's Save as Web addon handles hyperlink tooltips.
The original poster pointed out that in the 2002 version a hyperlink's description text was displayed as the user 'moused-over' a given shape, but that in 2003 and 2007 version the tooltip displays a standard message ('Click to follow hyperlink.') irrespective of the underlying link...
Why the change?
The Save as Web addon was greatly improved in 2003 with new functionality such as the Pan and Zoom widget. In 2002 the tooltip only had one job to do, that of displaying the hyperlink/s description. Additionally shape data (or custom properties) were displayed on mouseover. access to shape data changed in 2003 to requiring the user to Ctrl + Click on the respective shape. My assumption, therefore, is that the tooltip was now needed for two tasks: a) to indicate a hyperlink was available and b) to show how to display the shape's associated data.
So that's one possible explanation as to why the tooltip changed but how about trying to change it back?
Changing the tooltip - a walkthrough
As it happens all of the data is still available to display the hyperlink description in the tooltip and all that's required is to change a very small section of code. Here's a walkthrough:
- Open the main (.htm) output page in an editor or something like Notepad and search for the following line (note there should only one instance): strTooltip += strHL;
- Once found, replace this line with the following and save the file:
if (hlObj.DoFunction.length > 0)
{
strTooltip += strHL;
}
else
{
strTooltip += "Click for: \'" + hlObj.Desc + "\'";
}
There's already a hyperlink object created within the function (UpdateTooltip) so we can just reference its description property and amend the tooltip string before it gets updated in the markup.
The last line is the main change but we just need to wrap this in an if statement, which checks to see if there's more than one hyperlink for the shape. If that's the case then a context menu is generated and this actually contains the link descriptions as links by default.
If you're interested in other Save as Web hyperlink/tooltip functionality here are a few links to checkout: