Changes

Jump to navigation Jump to search
Line 172: Line 172:  
You can also use the '''id''' attribute to reference the element in your code after the UI has been loaded.
 
You can also use the '''id''' attribute to reference the element in your code after the UI has been loaded.
   −
The game will try to find a corrosponding variable to set for the element for any other attributes you use (Remember case sensitivity). Some elements, like the button, input and combo have event variables, i.e. '''onClick''', '''onValueChanged''' and '''OnSelectedChanged''' (use visual studio's code lookup feature to see what is possible), these can be set to function calls that will be called directly on an object you set when creating the UI, i.e. the  onClick="ShowMessage(Hehe)" part. Here's an example of how you would create and use this UI:
+
The game will try to find a corrosponding variable to set for the element for any other attributes you use (Remember case sensitivity). Some elements, like the '''button''', '''input''' and '''combo''' have event variables, i.e. '''onClick''', '''onValueChanged''' and '''OnSelectedChanged''' (use visual studio's code lookup feature to see what is possible), these can be set to function calls that will be called directly on an object you set when creating the UI, i.e. the  onClick="ShowMessage(Hehe)" part. Here's an example of how you would create and use this UI:
 
<pre class="language-cs">var elements = WindowManager.GenerateUI(ParentMod.LoadFullXMLFile("UI.xml"), null, this);
 
<pre class="language-cs">var elements = WindowManager.GenerateUI(ParentMod.LoadFullXMLFile("UI.xml"), null, this);
 
var label = (Text)elements["lab"];
 
var label = (Text)elements["lab"];

Navigation menu