ctrlSetStructuredText: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "_{10,} " to "") |
Lou Montana (talk | contribs) m (Text replacement - " *\| *([Cc]omments|COMMENTS|Game|[Gg]ame [Nn]ame|Game [Vv]ersion|Game Version \(number surrounded by NO SPACES\)|Multiplayer Arguments( \("local" or "global"\))?|Effects|Multiplayer Effects( \("local" or "global"\))?|Multiplayer Exe...) |
||
Line 1: | Line 1: | ||
{{Command | {{Command | ||
| arma1 | | arma1 | ||
|1.00 | |1.00 | ||
|gr1= GUI Control | |gr1= GUI Control | ||
|gr2= Structured Text | |gr2= Structured Text | ||
| Set the [[Structured Text]] which will be displayed in [[DialogControls-Text#CT_STRUCTURED_TEXT.3D13|structured text control]]. | | Set the [[Structured Text]] which will be displayed in [[DialogControls-Text#CT_STRUCTURED_TEXT.3D13|structured text control]]. | ||
|pr= Using this command will modify the provided ''structuredText'' - a way to circumvent this issue is to [[parseText]] in-line. See [[#Notes|Notes]]. |Problems= | |pr= Using this command will modify the provided ''structuredText'' - a way to circumvent this issue is to [[parseText]] in-line. See [[#Notes|Notes]]. |Problems= | ||
| control [[ctrlSetStructuredText]] structuredText | | control [[ctrlSetStructuredText]] structuredText | ||
|p1= control: [[Control]] | |p1= control: [[Control]] | ||
|p2= structuredText: [[Structured Text]] | |p2= structuredText: [[Structured Text]] | ||
| [[Nothing]] | | [[Nothing]] | ||
|x1= <code>_control [[ctrlSetStructuredText]] [[parseText]] "First line<img image<nowiki>=</nowiki>data\isniper.paa /><nowiki><br /></nowiki>Second line"</code> | |x1= <code>_control [[ctrlSetStructuredText]] [[parseText]] "First line<img image<nowiki>=</nowiki>data\isniper.paa /><nowiki><br /></nowiki>Second line"</code> | ||
|x2= To adjust text vertically, add extra line above with blank space (&#160;) and set its size accordingly:<code>[[with]] [[uiNamespace]] [[do]] { | |x2= To adjust text vertically, add extra line above with blank space (&#160;) and set its size accordingly:<code>[[with]] [[uiNamespace]] [[do]] { | ||
button = [[findDisplay]] 46 [[ctrlCreate]] ["RscShortcutButton", -1]; | button = [[findDisplay]] 46 [[ctrlCreate]] ["RscShortcutButton", -1]; | ||
Line 28: | Line 28: | ||
button [[ctrlSetStructuredText]] [[parseText]] | button [[ctrlSetStructuredText]] [[parseText]] | ||
"<t size='0.5'>&#160;</t><nowiki><br/></nowiki><t size='1' align='center'>Button Text&#160;&#160;</t>"; | "<t size='0.5'>&#160;</t><nowiki><br/></nowiki><t size='1' align='center'>Button Text&#160;&#160;</t>"; | ||
};</code> | };</code> | ||
|x3= There is a bug with <tt>valign</tt> that requires adding 1 extra trailing space per line to the displayed text in order to keep it centered horizontally: | |x3= There is a bug with <tt>valign</tt> that requires adding 1 extra trailing space per line to the displayed text in order to keep it centered horizontally: | ||
Line 40: | Line 40: | ||
[[private]] _trailingSpace = ""; | [[private]] _trailingSpace = ""; | ||
[[for]] "_i" [[from]] 1 [[to]] _linesTotal [[do]] { _trailingSpace = _trailingSpace + " " }; | [[for]] "_i" [[from]] 1 [[to]] _linesTotal [[do]] { _trailingSpace = _trailingSpace + " " }; | ||
_ctrl [[ctrlSetStructuredText]] [[parseText]] [[format]] ["<t size='%1'><t size='1' align='center' valign='middle'>%2%3</t> </t>", _linesTotal, "------ Centered Text ------", _trailingSpace];</code> | _ctrl [[ctrlSetStructuredText]] [[parseText]] [[format]] ["<t size='%1'><t size='1' align='center' valign='middle'>%2%3</t> </t>", _linesTotal, "------ Centered Text ------", _trailingSpace];</code> | ||
| [[Structured Text]], [[composeText]], [[parseText]], [[text]] | | [[Structured Text]], [[composeText]], [[parseText]], [[text]] | ||
}} | }} | ||
Revision as of 00:28, 18 January 2021
Description
- Description:
- Set the Structured Text which will be displayed in structured text control.
- Problems:
- Using this command will modify the provided structuredText - a way to circumvent this issue is to parseText in-line. See Notes.
- Groups:
- GUI ControlStructured Text
Syntax
- Syntax:
- control ctrlSetStructuredText structuredText
- Parameters:
- control: Control
- structuredText: Structured Text
- Return Value:
- Nothing
Examples
- Example 1:
_control ctrlSetStructuredText parseText "First line<img image=data\isniper.paa /><br />Second line"
- Example 2:
- To adjust text vertically, add extra line above with blank space ( ) and set its size accordingly:
with uiNamespace do { button = findDisplay 46 ctrlCreate ["RscShortcutButton", -1]; button ctrlSetPosition [0,0,0.3,0.1]; button ctrlCommit 0; button ctrlSetStructuredText parseText "<t size='0.5'> </t><br/><t size='1' align='center'>Button Text  </t>"; };
- Example 3:
- There is a bug with valign that requires adding 1 extra trailing space per line to the displayed text in order to keep it centered horizontally:
disableSerialization; private _ctrl = findDisplay 46 ctrlCreate ["RscStructuredText", -1]; _ctrl ctrlSetPosition [0, 0, 0.5, 0.5]; _ctrl ctrlSetBackgroundColor [0, 0, 0, 1]; _ctrl ctrlCommit 0; private _lineHeight = getNumber (configFile >> "RscStructuredText" >> "size"); private _linesTotal = (ctrlPosition _ctrl select 2) / _lineHeight; private _trailingSpace = ""; for "_i" from 1 to _linesTotal do { _trailingSpace = _trailingSpace + " " }; _ctrl ctrlSetStructuredText parseText format ["<t size='%1'><t size='1' align='center' valign='middle'>%2%3</t> </t>", _linesTotal, "------ Centered Text ------", _trailingSpace];
Additional Information
- See also:
- Structured TextcomposeTextparseTexttext
Notes
-
Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
Notes
- Posted on March 20, 2020 - 19:48 (UTC)
- Dscha
-
When using parseText on an RscStructuredText control, with custom Attributes set (extra config Class), it needs to be in the same line as ctrlSetStructuredText:
_text = "abc"; _ctrl ctrlSetStructuredText parseText _text;
The following Code would use none of the custom Attributes of the selected Control, instead it falls back to Standard Values (Font, Size, Color, Align, etc)_text = parseText "abc"; _ctrl ctrlSetStructuredText _text;