# UI Files All GUI elements in Unigine are generated on the fly from UI files, which are in the XML format. These files describe [containers](../../../code/gui/ui/ui_containers.md) and [widgets](../../../code/gui/ui/ui_widgets.md) provided by Unigine. Each of them is described by an XML tag in the UI file. ## UI File Syntax As a correct XML file, a UI file must start with a standard declaration. The second required element is a root tag *ui*. This root element can contain zero or more other elements (tags) specifying the interface. ```xml ``` If a UI file is not syntactically correct, Unigine will log the error to the console and the main log file. > **Notice:** All UI files are treated as having the UTF-8 encoding, even if you specify another one in the declaration. > Not all available GUI elements can be defined using XML. Some of them � like manipulators and specialized dialogs and sprites - are set up only via [scripting](../../../api/library/gui/index.md): > > > - [WidgetManipulator](../../../api/library/gui/class.widgetmanipulator_cpp.md) > - [WidgetManipulatorRotator](../../../api/library/gui/class.widgetmanipulatorrotator_cpp.md) > - [WidgetManipulatorScaler](../../../api/library/gui/class.widgetmanipulatorscaler_cpp.md) > - [WidgetManipulatorTranslator](../../../api/library/gui/class.widgetmanipulatortranslator_cpp.md) > - [WidgetDialogColor](../../../api/library/gui/class.widgetdialogcolor_cpp.md) > - [WidgetDialogFile](../../../api/library/gui/class.widgetdialogfile_cpp.md) > - [WidgetDialogImage](../../../api/library/gui/class.widgetdialogimage_cpp.md) > - [WidgetDialogMessage](../../../api/library/gui/class.widgetdialogmessage_cpp.md) > - [WidgetSpriteNode](../../../api/library/gui/class.widgetspritenode_cpp.md) > - [WidgetSpriteShader](../../../api/library/gui/class.widgetspriteshader_cpp.md) > - [WidgetSpriteVideo](../../../api/library/gui/class.widgetspritevideo_cpp.md) > - [WidgetSpriteViewport](../../../api/library/gui/class.widgetspriteviewport_cpp.md) ### Attributes Almost all of the UI file tags have attributes, and it is good to know the following general rules: - All dimensions provided as attribute values are in pixels. - File names are relative to the [root data directory](../../../principles/filesystem/index_cpp.md#paths). - Colors are in the Web format, that is, #RRGGBB, or in the #RRGGBBAA format. Here RR, GG, BB, and AA correspond to a hexadecimal color component value�red, green, blue, and alpha, respectively; values range from 00 to FF. - Boolean values can be set in different forms. For FALSE use: 0, false, no. For TRUE use: 1, true, yes. Here is an example element with attributes: ```xml ``` ### Comments You can use standard XML comments syntax. Comment blocks will be skipped during processing of a UI file. An example comment: ```xml ``` ## Common Attributes All GUI elements�both [containers](../../../code/gui/ui/ui_containers.md) and [widgets](../../../code/gui/ui/ui_widgets.md) �can have the following attributes. ### name A unique name of the widget. If the [export](#param_export) flag is set to **yes**, the widget will be referred to in scripts by this name. The name may contain a namespace specification and/or an array index. ```xml ``` - **background** Places the widget underneath other widgets in the same container. Use this flag together with *[overlap](#overlap)* one. - **fixed** Places the widget in focus on the background or on the foreground (depending on where it was created). This flag is valid only if *[overlap](#overlap)* flag is also set. Non-fixed overlapping windows can pop over the fixed ones, while the latter cannot do it. ### enabled A flag that specifies whether the widget is enabled. An enabled widget receives keyboard and mouse events; a disabled widget does not. Some widgets display themselves differently when they are disabled (usually they are dimmed). If a container is disabled, its content is also disabled. Acceptable values: - **0** or **no** The widget is disabled. - **1** or **yes** The widget is enabled. ![enabled](parameters/enabled.png) ```xml ``` ### hidden A flag that specifies whether the widget is hidden or not. When a widget is hidden, it is not rendered, and other widgets in the same container are re-arranged. Acceptable values: - **0** or **no** The widget renders normally. - **1** or **yes** The widget is hidden. ![not hidden](parameters/hidden_0.png) ![hidden](parameters/hidden_1.png) ```xml ``` ### pos_x The *x* -coordinate of the widget relative to the top left corner of its parent container. It takes effect only if the **overlap** [alignment flag](#param_align) is set. ![pos_x](parameters/pos_x.png) ```xml