| Blockland Forums > Modification Help |
| [Resource] Text Anchors (tags) |
| (1/2) > >> |
| Greek2me:
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): --- Quote ---<tag:tagID> --- End quote --- TagID must be an integer. The Link: --- Quote ---<a:#tagID>This is a link!</a> --- End quote --- TagID must be an integer that matches up with a <tag> on the page. Example: --- Quote ---<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> --- End quote --- This code is required: --- Code: ---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); --- End code --- 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 |
| elm:
Very nice, I think badspot should add in a sub forum for resources. I think it'll encourage others to actually make resources which can help developers. I know I would be encouraged. |
| Treynolds416:
I agree This would probably have gone better in general discussion though |
| Greek2me:
We should ask Badspot to make one. He probably won't though. |
| elm:
--- Quote from: Greek2me on May 06, 2012, 12:36:28 PM ---We should ask Badspot to make one. He probably won't though. --- End quote --- Ok make a petition and ill sign it! (im serious) |
| Navigation |
| Message Index |
| Next page |