ctrlSetStructuredText: Difference between revisions
Jump to navigation
Jump to search
Killzone Kid (talk | contribs) mNo edit summary |
Killzone Kid (talk | contribs) (example) |
||
Line 20: | Line 20: | ||
|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> |= Example 1 | ||
|x2= To | |x2= To adjust text vertically, add extra line above with blank space (&#160;) and set its size appropriately:<code>[[with]] [[uiNamespace]] [[do]] { | ||
button = [[findDisplay]] 46 [[ctrlCreate]] ["RscShortcutButton", -1]; | button = [[findDisplay]] 46 [[ctrlCreate]] ["RscShortcutButton", -1]; | ||
button [[ctrlSetPosition]] [0,0,0.3,0.1]; | button [[ctrlSetPosition]] [0,0,0.3,0.1]; | ||
Line 27: | Line 27: | ||
"<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> |= Example 1 | };</code> |= Example 1 | ||
|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]]; | |||
[[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];</code>|=Example 3 | |||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
Revision as of 10:40, 24 January 2019
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 ( ) and set its size appropriately:
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