Arma 3 Scripting

Command in GUI Control

ctrlSetText

Also available as Markdown and JSON, or read the original wiki page.

Description

Sets the text of a control of the currently active user dialog or display. This command can be used for static texts, buttons, edit lines and active texts as well as for images, where you can use it to set the image path.

Read Arma: GUI Configuration for more information about user dialogs and controls.

Use endl to insert line breaks.

Since Arma 3 v2.06 supported control types are:

Since Arma 3 v2.22 CT_PROGRESS is also supported.

Syntax

Syntax 1

ctrlSetText [idc, text]

Parameters:

Returns: Nothing

Syntax 2

control ctrlSetText text

Parameters:

Returns: Nothing

Examples

Example 1

ctrlSetText [100, "Hello world"]; // for Dialogs

Example 2

_control ctrlSetText "Hello world."; // for Displays

Example 3

Since Arma 3 2.22:

with uiNamespace do 
{ 
 bar = findDisplay 46 ctrlCreate ["RscProgress", -1]; 
 bar ctrlSetText "\A3\Data_F\Flags\Flag_red_CO.paa";
 bar ctrlSetPosition [0,0,1,0.25]; 
 bar ctrlCommit 0; 
 bar progressSetPosition 0.7;
};

See also

ctrlText · ctrlTextSelection · ctrlSetTextSelection