Creation/Dev/Script/Client/GuiMLTextCtrl: Difference between revisions
(→Tags) |
|||
Line 76: | Line 76: | ||
a few HTML-tags and Torque-tags, you can use both | a few HTML-tags and Torque-tags, you can use both | ||
of those tag types to define colors and fonts | of those tag types to define colors and fonts | ||
or to include images. Currently following tags | or to include images. The Torque-tags (previously added for compatibility) will be disabled in some time in the future, so it's recommended to use plain HTML tags. Currently following tags are available: | ||
are available: | |||
'''HTML:''' | '''HTML:''' | ||
Line 91: | Line 90: | ||
- 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 | |||
<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 | |||
</pre> | |||
'''Torque:''' | |||
<pre> | |||
<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) | |||
</pre> | |||
<h1> text </h1> .. <h6> text <h6> - draws text as a head line (with bigger fonts) | <h1> text </h1> .. <h6> text <h6> - draws text as a head line (with bigger fonts) | ||
<hr> - draws a horizontal line | <hr> - draws a horizontal line |
Revision as of 10:23, 31 August 2008
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. The Torque-tags (previously added for compatibility) will be disabled in some time in the future, so it's recommended to use plain HTML tags. 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)
text
..
text - draws text as a head line (with bigger fonts)
- draws a horizontal line
text - draws text with italic font
<ignorelinebreaks> </ignorelinebreaks> - go into normal HTML mode where
you need to insert
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
text
- sets the alignment of the
contained text
- for
displaying a subpage, you can also specifiy an id for
onSelectTag-events; instead of you can also use tags
- item
- displays a list, each item is indented
- item
- like , 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>";
}
- draws a horizontal line
to do a linebreak
- item - displays a list, each item is indented
- item
- , 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>"; }