---
name: "ctrlSetStructuredText"
type: command
status: ok
groups: ["GUI Control", "Structured Text"]
arma3_since: "0.50"
locality: {"argument": null, "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/ctrlSetStructuredText
revid: 321026
updated: 2022-05-13T11:32:18Z
---

# ctrlSetStructuredText

*Command · GUI Control, Structured Text · Arma 3 v0.50 · introduced in Armed Assault v1.00*

## Description

Set the [Structured Text](../topics/Structured_Text.md) which will be displayed in structured text control.

## Syntax

```sqf
control ctrlSetStructuredText structuredText
```

**Parameters:**

- `control`: [Control](../topics/Control.md)
- `structuredText`: [Structured Text](../topics/Structured_Text.md)

**Returns:** [Nothing](../topics/Nothing.md)

## Examples

### Example 1

```sqf
_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:

```sqf
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:

```sqf
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];
```

## Problems

Using this command will modify the provided *structuredText* - a way to circumvent this issue is to [parseText](../commands/parseText.md) in-line. See [Notes](../commands/ctrlSetStructuredText.md#notes).

## See also

[Structured Text](../topics/Structured_Text.md) · [composeText](../commands/composeText.md) · [parseText](../commands/parseText.md) · [text](../commands/text.md)

## Community notes

**Dscha** — 2020-03-20

When using [parseText](../commands/parseText.md) on an RscStructuredText control, with **custom Attributes** set (extra config Class), it needs to be in the same line as [ctrlSetStructuredText](../commands/ctrlSetStructuredText.md):

```sqf
_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)

```sqf
_text = parseText "abc";
_ctrl ctrlSetStructuredText _text;
```

<sub>Source: [BI Community Wiki — ctrlSetStructuredText](https://community.bistudio.com/wiki/ctrlSetStructuredText) (revision 321026).</sub>
