Creation/Dev/Script/Client/GuiMLTextCtrl: Difference between revisions
m (→Tags) |
(→Tags: Added the v4.2 html tags) |
||
Line 81: | Line 81: | ||
'''HTML:''' | '''HTML:''' | ||
<pre> | <pre> | ||
<a href=url> text </a> - when the user clicks on 'text' then | <a href=url> text </a> - when the user clicks on 'text' then a | ||
web browser is opened for the specified url (actually it is just | |||
calling controlname.onURL(url) and the script needs to call openurl(url) then) | |||
<b> text </b> - draws text with bold font | <b> text </b> - draws text with bold font | ||
<body bgcolor=colorname or #rrggbb> - sets the background color | <body bgcolor=colorname or #rrggbb background=imagename> - sets the background color or image | ||
<br> - line break | <br> - line break | ||
<center> text </center> - centers the contained text | <center> text </center> - centers the contained text | ||
Line 90: | Line 91: | ||
- draws text with a special font, size and color; you only | - draws text with a special font, size and color; you only | ||
need to define one of those 3 attributes | need to define one of those 3 attributes | ||
<h1> text </h1> .. <h6> text <h6> - draws text as a head line (with bigger fonts) | |||
<hr> - draws a horizontal line | |||
<i> text </i> - draws text with italic font | <i> text </i> - draws text with italic font | ||
<ignorelinebreaks> </ignorelinebreaks> - go into normal HTML mode where | <ignorelinebreaks> </ignorelinebreaks> - go into normal HTML mode where | ||
Line 101: | Line 104: | ||
displaying a subpage, you can also specifiy an id for | displaying a subpage, you can also specifiy an id for | ||
onSelectTag-events; instead of <span> you can also use <div> tags | onSelectTag-events; instead of <span> you can also use <div> tags | ||
<ul type="disc" or "square" or "circle"><li>item</li><li></li></ol> - displays a list, each item is indented | |||
<ol><li>item</li></ol> - like <ul>, but is numerating each list item | |||
</pre> | </pre> | ||
Revision as of 18:22, 9 February 2007
Inherits GuiControl.
Description
Displays a multi-lined text which can contain several HTML-tags. This should be put in a GuiScrollCtrl to avoid text being clipped and not being displayed.
GuiMLTextCtrl is also used for displaying hints when moving the mouse over a GuiControl.
Variables
allowcolorchars - boolean
allowedtags - string
alpha - float
deniedsound - string
disallowedtags - string
maxchars - integer
parsetags - boolean
syntaxhighlighting - boolean
text - string
wordwrap - boolean
Functions
addtext(str, bool)
getcursorline() - returns integer
getline(int) - returns string
getlinecount() - returns integer
getlines() - returns object - array of lines
gettext() - returns string
reflow()
scrolltobottom()
scrolltotag(int)
scrolltotop()
setlines(obj)
settext(str)
Events
onCursorLineChanged(line) - the cursor has been moved to another line
onSelectedTag(tagid) - an image inside the control has been clicked (<img src=imagefile id=tagid>-tag)
onURL(url) - an url has been clicked (<a href=url>-tag)
onReflow(newwidth,newheight) - the size of the displayed text has been changed
Tags
The text of multi-line text controls can contain a few HTML-tags and Torque-tags, you can use both of those tag types to define colors and fonts or to include images. Currently following tags are available:
HTML:
<a href=url> text </a> - when the user clicks on 'text' then a web browser is opened for the specified url (actually it is just calling controlname.onURL(url) and the script needs to call openurl(url) then) <b> text </b> - draws text with bold font <body bgcolor=colorname or #rrggbb background=imagename> - sets the background color or image <br> - line break <center> text </center> - centers the contained text <font face=fontname size=textsize color=colorname or #rrggbb> text </font> - draws text with a special font, size and color; you only need to define one of those 3 attributes <h1> text </h1> .. <h6> text <h6> - draws text as a head line (with bigger fonts) <hr> - draws a horizontal line <i> text </i> - draws text with italic font <ignorelinebreaks> </ignorelinebreaks> - go into normal HTML mode where you need to insert <br> to do a linebreak <img src=filename id=integer> - an image is displayed, you can also specify a tagid if you want to get onSelectTag-events for this image <p align=left/center/right> text </p> - sets the alignment of the contained text <span style="width=100; height=100;" id=integer> </span> - for displaying a subpage, you can also specifiy an id for onSelectTag-events; instead of <span> you can also use <div> tags <ul type="disc" or "square" or "circle"><li>item</li><li></li></ol> - displays a list, each item is indented <ol><li>item</li></ol> - like <ul>, but is numerating each list item
Torque:
<a:url> text </a> - when the user clicks on 'text' then a web browser is opened for the specified url <bitmap:filename> - an image is displayed <color:rrggbb> - sets the color of the text (hexadecimal value) <lmargin:pixels> - sets the left margin for the text <lmargin%:percent> - sets the size of the left margin depending on the width of the whole control <linkcolor:rrggbb> - sets the color of links (the <a>-tag) <linkcolorhl:rrggbb> - sets the highlighted color, when the user moves the mouse over a link <just:left/center/right> - sets the alignment of the following text <rmargin:pixels> - sets the right margin for the text <rmargin%:percent> - sets the size of the right margin depending on the width of the whole control <sbreak> - line break <spush> - switches to a new style (like <font>) <spop> - switches back to the last saved style (like </font>) <tab:tab1,tab2,..> - sets the position of where tabulators should be displayed if you have text like 'Apple \t Egg \t Chicken' <tag:id> - inserts an invisible tag which can be used for the scrollToTag(id) function (beside image-tags)
Example
new GuiMLTextCtrl("Test_MultiLineText") { profile = GuiBlueMLTextProfile; x = 10; y = 10; width = 160; height = 60; text = "<font size=24><i>Multiline-<br>Text</i></font>"; }