Changes

Jump to navigation Jump to search
Line 168: Line 168:  
This will create a window with a scroll view containing a label, a button and a combobox automatically laid out vertically. Please note that attributes, e.g. '''position'''="4,4" are case sensitive!
 
This will create a window with a scroll view containing a label, a button and a combobox automatically laid out vertically. Please note that attributes, e.g. '''position'''="4,4" are case sensitive!
   −
To position an element you can use the '''anchor''' attribute to decide where the element should be anchored to in the element it is sitting in. The anchor is basically a box that contains the element formatted as x,y,width,height, where all values should be between 0-1, representing 0-100% in the parent element. An anchor of (0,0,0,0) is just the top left corner of the element and (0,0,1,1) is an anchor that fills the entire element, since width and height is 1=100%. '''position''' is the x, y pixel offset from the top left of the anchor. '''size''' or '''width''' and '''height''' is the pixel offset from the bottom right corner of the anchor. '''anchor''' can be formatted as either '''#,#,#,#''', '''middle,center''', '''bottom,right''', '''top'''(to fill the entire top), '''left''' to the fill the left side or '''fill''' to fill the entire element. Note that in the scroll view I'm using anchor="fill" position="4,4" size="-8,-8", because I want it to fill the parent window with a 4 pixel margin, so I have to decrease the size by 4 x 4 = 8, which is why size is -8,-8.
+
To position an element you can use the '''anchor''' attribute to decide where the element should be anchored to in the element it is sitting in. The anchor is basically a box that contains the element formatted as x,y,width,height, where all values should be between 0-1, representing 0-100% in the parent element. An anchor of (0,0,0,0) is just the top left corner of the element and (0,0,1,1) is an anchor that fills the entire element, since width and height is 1=100%. '''position''' is the x, y pixel offset from the top left of the anchor. '''size''' or '''width''' and '''height''' is the pixel offset from the bottom right corner of the anchor. '''anchor''' can be formatted as either "'''#,#,#,#'''", "'''middle,center'''", "'''bottom,right'''", "'''top'''"(to fill the entire top), "'''left'''"(to the fill the left side) or "'''fill'''" to fill the entire element, etc. Note that in the scroll view I'm using anchor="fill" position="4,4" size="-8,-8", because I want it to fill the parent window with a 4 pixel margin, so I have to decrease the size by 4 x 4 = 8, which is why size is -8,-8.
    
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.

Navigation menu