View Single Post
07/24/14, 09:01 AM   #16
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
Originally Posted by zgrssd View Post
So instead of being a seperate type of control (like <Label/>, <EditBox/> and the like) that has other elements as childs, the scroll container is a "Control" whose inherits atribute was set? The same way you set a <Backdrop/> inherits atrbute, to tell it wich Backdrop it has to look like?
Not exactly "instead of being a separate type of control", it's just a generic type of control which doesn't have an appearance of its own, a container for other controls. Any control may inherit attributes & contents from a template. But I guess you can only sensibly inherit from the same type of control, i.e. Backdrop inherits from another Backdrop, Label from another Label, etc.

Originally Posted by zgrssd View Post
I try to get some understanding of what happens via the rules that apply to WPF.
I would refrain from drawing similarities. Although I don't know WPF, there will certainly be differences, and concepts from one system might not apply to another. If we're talking strictly XML DOM, then your two examples are completely different things:

This is element node <Label> with no attributes and 1 child element node <Content>, which in turn has 1 child text node with value "Test":
Originally Posted by zgrssd View Post
xml Code:
  1. <Label>
  2.     <Content>
  3.         "Test"
  4.     <Content/>
  5. </Label>
Whereas this is element node <Label> with 1 attribute Content="Test":
Originally Posted by zgrssd View Post
xml Code:
  1. <Label Content="Test"/>
I don't know how ESO parses XML, but I tell you if I were to do that, I'd take a ready-made library that would parse the file and give me DOM tree, and then just walk the tree. That attribute<=>text equality (or ambiquity) you decribed is a hack invented by people who thought XML should be written by humans, and they complicate their parsers to make that torture less painful.


Now back to ESO. They made their UI elements reusable through inheritance, so that any control can be used as a template. For example:
xml Code:
  1. <!-- these are templates -->
  2. <Label name="LeftBoldText" font="ZoFontGameBold" horizontalAlignment="LEFT" virtual="true" />
  3. <Label name="RightBoldText" font="ZoFontGameBold" horizontalAlignment="RIGHT" virtual="true" />
  4.  
  5. <!-- these are actual controls; you can have 50 of them,
  6.        and if you decide to change the font, you change it in the template -->
  7. <Label name="Label1" inherits="LeftBoldText"> ... </Label>
  8. <Label name="Label2" inherits="RightBoldText"> ... </Label>


Originally Posted by zgrssd View Post
Wich elements all have a "Controls" property and are thus containers?
Is it only "GuiXML", "Control" and "TopLevelControl"? All of them? All of them but a few?
In addition to those I found <Slider>, <EditBox>, <Tooltip>, <Label>, <Cooldown> with inner <Controls>. Perhaps all controls can have children, to me it'd seem logical, since <Control> can have them and I think that's the base for other controls, but who knows.

Last edited by merlight : 07/24/14 at 09:08 AM.
  Reply With Quote