This allows you to place links in GuiMLTextCtrl's to anchors that are farther down the page. When the link is clicked, the page will scroll down until the anchor is at the top of the page.
The Anchor (tag):<tag:tagID>
TagID must be an integer.
The Link:<a:#tagID>This is a link!</a>
TagID must be an integer that matches up with a <tag> on the page.
Example:<tag:0>Blah blah blah this is my example page. <a:#1>Click here</a> to view cool stuff farther down the page about goldfish. You can also go <a:#2>here</a> to view other cool stuff.
-snip-
<tag:1>This is where the cool stuff about goldfish goes. When you click the link above, you'll be brought here.
-snip-
<tag:2>This is where the other cool stuff goes.
<a:#0>Click here to go back to the top of the page.</a>
This code is required:package TextAnchors
{
function GuiMLTextCtrl::onURL(%this,%url)
{
%firstChar = getSubStr(%url,0,1);
if(%firstChar $= "#")
{
//scroll to the bottom first
//this fixes a bug in TorqueScript that makes obj.scrollToTag not work properly
%parentObj = %this.getGroup();
if(isObject(%parentObj) && isFunction(%parentObj.getClassName(),"scrollToBottom"))
%parentObj.scrollToBottom();
//now scroll back up to the tag
%restChars = getSubStr(%url,1,strLen(%url));
%this.scrollToTag(%restChars);
}
else
{
return parent::onURL(%this,%url);
}
}
};
activatePackage(TextAnchors);
This only works in GuiMLTextCtrl's that are children of GuiMLScrollCtrl's.
This is a pretty good example of its use:
http://greekmods.webs.com/mods/Gamemode_Slayer/Help/help_Release.txt