Page tree
Skip to end of metadata
Go to start of metadata


This control can display Structured Text (which is used to format text and images, similar to HTML).


To show formatted text in this control, the commands ctrlSetStructuredText and parseText have to be used on Structured Text, e.g.
_ctrl ctrlSetStructuredText parseText "<t color='#FF0000'>RED</t>"
(It is also possible to output plain, unformatted text via the ctrlSetText command, but in that case the control doesn't behave any different from a Dialogs Static.)

Settings defined in the properties of the control's sub-class "Attributes" (e.g. 'font', 'color') will be used as default attributes for the displayed text, but can be overridden by specific formatting options defined in the Structured Text passed, e.g. in "default size<t size='2'>base size</t>, the size for "default size" would be the result from multiplying the 'size' value in 'Attributes' with the 'size' value in the parent class, and "base size" would be twice the size defined in the parent class.


Only properties unique to this control type are listed. For general properties, see the Properties page.
If a property doesn't have a default value, then it must be defined explicitly.

Name Type Default Remark Script
type Integer - must be 13 (or CT_STRUCTURED_TEXT, if using constants) -
style Integer - always 0 (has no effect) -
text String - The text to display initially. ctrlSetStructuredText
size Float - Base size of text in control. Can be modified in the 'Attributes' size property (for default sizes), and is used as the basis if a font size is specified in the structured text. -
colorBackground Color - Background color ctrlSetBackgroundColor
Properties within the sub-class 'Attributes'.
Defines the default attributes of structured text (i.e. the case where no style attribute was applied).
font String (depends) Name of font to use (see Fonts for full list).
If not specified, then the first available font is used.
color String {1,1,1,1} Text color defined in HMTL-like syntax (#RRGGBB). ctrlSetTextColor
align String "left" Horizontal alignment of text within the control.
Can be "left", "center" or "right".
shadow Boolean 1 Enables or disables text shadows. Non-functional in V2.x+ -
shadowColor String {0,0,0,1} Shadow color defined in HMTL-like syntax (#RRGGBB).
Non-functional in V2.x+
size String 1 Relative size of text (in respect to the 'size' defined in the general control properties), where 1 would be the same size as the parent class, and 2 would be twice as big. Used if no specific font size is defined within the structured text. -


Creates output as shown at the top of this page.

description.ext, dialog definition:

class Dlg {
  idd = 20000;
  movingEnable = 1;

  class controls {
    class STRUCT {
      type = 13; 
      style = 0;
      idc = 20000; 
      colorBackground[] = { 1, 1, 1, 1 }; 
      x = 0.1; y = 0.1; 
      w = 0.37; h = 0.13; 
      size = 0.018;
      text = "";
      class Attributes {
        font = "TahomaB";
        color = "#000000";
        align = "center";
        shadow = 0;
        shadowColor = "#ff0000";
        size = "1.3";


dialog.sqf, opens dialog, and outputs some text:

createDialog "Dlg";
waitUntil {dialog};

_display = finddisplay 20000;
_ctrl = _display displayctrl 20000;

_text = "Text will use attributes defined in your class.<br/>" +
  "But you can <t underline='true'>change</t> them with <t font='LucidaConsoleB'>HTML</t> like statements.<br/>" +
  "<t shadow='true'>shadows</t> <t size='2'>Size</t> and <t valign='bottom'>valign</t> are only some of them.";

_ctrl ctrlSetStructuredText parseText _text;