ctrlSetStructuredText: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
mNo edit summary
m (template:command argument fix)
Line 7: Line 7:
____________________________________________________________________________________________
____________________________________________________________________________________________


| Set the [[Structured_Text|structured text]] which will be displayed in [[DialogControls-Text#CT_STRUCTURED_TEXT.3D13|structured text control]]. |= Description
| Set the [[Structured_Text|structured text]] which will be displayed in [[DialogControls-Text#CT_STRUCTURED_TEXT.3D13|structured text control]]. |DESCRIPTION=
____________________________________________________________________________________________
____________________________________________________________________________________________


| control '''ctrlSetStructuredText''' structuredText |= Syntax
| control '''ctrlSetStructuredText''' structuredText |SYNTAX=


|p1=  control: [[Control]] |= Parameter 1
|p1=  control: [[Control]] |PARAMETER1=


|p2= structuredText: [[Structured Text]] |= Parameter 2
|p2= structuredText: [[Structured Text]] |PARAMETER2=


| [[Nothing]] |= Return value
| [[Nothing]] |RETURNVALUE=
____________________________________________________________________________________________
____________________________________________________________________________________________
   
   
|x1= <code>_control [[ctrlSetStructuredText]] [[parseText]] "First line<img image<nowiki>=</nowiki>data\isniper.paa /><nowiki><br /></nowiki>Second line"</code> |= Example 1
|x1= <code>_control [[ctrlSetStructuredText]] [[parseText]] "First line<img image<nowiki>=</nowiki>data\isniper.paa /><nowiki><br /></nowiki>Second line"</code> |EXAMPLE1=
|x2= To adjust text vertically, add extra line above with blank space (&amp;#160;) and set its size accordingly:<code>[[with]] [[uiNamespace]] [[do]] {
|x2= To adjust text vertically, add extra line above with blank space (&amp;#160;) and set its size accordingly:<code>[[with]] [[uiNamespace]] [[do]] {
button = [[findDisplay]] 46 [[ctrlCreate]] ["RscShortcutButton", -1];
button = [[findDisplay]] 46 [[ctrlCreate]] ["RscShortcutButton", -1];
Line 26: Line 26:
button [[ctrlSetStructuredText]] [[parseText]]  
button [[ctrlSetStructuredText]] [[parseText]]  
"<t size='0.5'>&amp;#160;</t><nowiki><br/></nowiki><t size='1' align='center'>Button Text&amp;#160;&amp;#160;</t>";
"<t size='0.5'>&amp;#160;</t><nowiki><br/></nowiki><t size='1' align='center'>Button Text&amp;#160;&amp;#160;</t>";
};</code> |= Example 1
};</code> |EXAMPLE1=
|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:
<code>[[disableSerialization]];
<code>[[disableSerialization]];
Line 37: Line 37:
[[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>|=Example 3
_ctrl [[ctrlSetStructuredText]] [[parseText]] [[format]] ["<t size='%1'><t size='1' align='center' valign='middle'>%2%3</t> </t>", _linesTotal, "------ Centered Text ------", _trailingSpace];</code>|EXAMPLE3=
____________________________________________________________________________________________
____________________________________________________________________________________________


| [[Structured Text]], [[composeText]], [[parseText]], [[text]] |= See also
| [[Structured Text]], [[composeText]], [[parseText]], [[text]] |SEEALSO=


}}
}}

Revision as of 14:37, 7 April 2019

-wrong parameter ("Arma") defined!-1.00
Hover & click on the images for description

Description

Description:
Set the structured text which will be displayed in structured text control.
Groups:
Uncategorised

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 (&#160;) 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'>&#160;</t><br/><t size='1' align='center'>Button Text&#160;&#160;</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

Bottom Section