|
07/24/14, 09:10 AM | #1 |
|
Lua XML Basics
I am trying to get the hang of UI XML and so far I am not getting good. So I think need to start with a lot more basic stuff.
The top element of all XML files must be the "<GuiXml>" Tag The second tier must tbe the "<Controls>" Tag under wich you can define your actuall elements. There seem to be at least 3 Container Elements (elements with a Controls child element): GuiXML - the root of all XML files TopLevelControl - For Windows. Is automatically added to the UI upon execution without needing to call it. Control - for templates in particular. It also seems to be the only "Container" you can use at any level. Data like the Dimensions, anchoring or fill mode are not listed as Atributes of the Element. Instead they are assigned via child elements called "Anchoring" or "Dimensions". Not sure how to call those class, "Child Atributes" perhaps? Data like Backdrops (the background to be used) must be assigned as a Child of the Controls object that is itself asigned as child of the container. So the most basic Window XML looks somewhat like this: xml Code:
Know Atributes: name - (optional) a Reference to this element will be stored in the Global Variables with this name. This is nessesary if you want to access it from code behind directly. The '$(parent)[suffix]' Syntax allows you to name a Child based on the name of it's parent and a suffix. inherits - Seems to allow high level behavior changes. A Control type Container where 'inherits="ZO_ScrollContainer"' is written, behaves as a Scroll Container (if the Content is bigger then the Containers dimension, a Scroll Bar appears). hidden - boolean value. Determines if the element is hidden by default. Usefull in particular for TopLevelControls that should be initialised automatically, but not shown automatically (there but hidden) font, text - common for Elements that show Text, be it labels, Editboxes. virtual - if true, this is a virtual Element. It is used as template for teh "CreateFromVirtual" function. Is not put into the global namespace, but instead used as String Indentifier for the "CreateFromVirtual" function. Questions: Wich Elements can all have a "Controls" child element? Wich common GUI Values must be assigned as atributes, wich as Direct level child element and wich as Controls Child Element? |
07/24/14, 11:16 AM | #2 |
|
Backdrop is a type of control, that's why it goes under <Controls>.
These are all control type constants, each has corresponding XML element: Lua Code:
|
07/24/14, 01:11 PM | #3 |
|
So iriterating what I said before on teh other thread, there are three basic types of UI XML Elements:
Property Children: XML Child Elementes with the sole purpose of defining stuff about thier parent. They don't inherit from control, and are mostly structure like things. But they can have short inheritance chains and functions as well. The Property Children every Control can have is preset. Controls Consisting of Control and every UI Element that inherits it. They are all containers on top of being stand alone controls, having a "Controls" Property Child with the purpose of containing further Controls. Atributes: There are also conventinal XML atributes. They are always of type string. Overall Property Children seem a lot more common then classical Atributes. inherits & virtual: A control can inherit values from every virtual control that was defined in xml. Virtual controls do not appear in the global table, but propably are defined/listed in some subtable. Only virtual controls can be inherited, but every control can be made virtual. There might be limitations that only elemenst of the same base type can inherit (a Label can only inherit from a virtual Label), but that is not confirmed. |
07/24/14, 01:36 PM | #4 | |
|
offsetX="-5" ... used in <Anchor>, this attribute probably undergoes ivalue = tonumber(value) before being passed to control:SetAnchor(...) point="LEFT" ... named constant, not sure whether point="2" (since LEFT == 2) would work; but I still think it's converted to integer at some point, ivalue = _G[value] color="3a6b9c" ... hex color code, may be parsed by a, r, g, b = ConvertHTMLColorToFloatValues(value) color="INTERFACE_COLOR_TYPE_ALLIANCE:ALLIANCE_DAGGERFALL_COVENANT" ... another way of specifying color; the conversion would look something like: Lua Code:
Last edited by merlight : 07/24/14 at 06:03 PM. |
|
07/24/14, 03:24 PM | #5 |
Maybe not very well known is the "Virtual/Inherits" Mechanism.
Basically it's used to create a template and use that one instead of repeating the same xml over and over Here an example: Lua Code:
This declares a virtual Control (means which is not used by itself) ,which already predefines certain aspects ,even incl. programming logic ,as you can see on the "OnMouseExit" part. Now later on in the XML i make use of the virtual template like this: Lua Code:
it then takes over the definition of "Alpha" ,"Dimensions" and "OnMouseExit" . Meaning that the Button created has all the properties inherited by it's template. By the way on the Wiki is clearly defined which Child are allowed for the Element "Control": http://wiki.esoui.com/UI_XML#Control Also i might add, if you use ZBS with my Plugin, there is some support for GuiXML build in: |
|
ESOUI » Developer Discussions » Lua/XML Help » Lua XML Basics |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Switch to Linear Mode |
Hybrid Mode |
Switch to Threaded Mode |
|
|