Using variables in .layout files
Posted: Wed Aug 03, 2011 12:33
Hey. I was wondering how I would go about not using "magic numbers" for positioning interface elements in the layout files. Is there a way to use variables in .layout files to specify property values? For example, If i have a static text that I am positioning using:
<Property Name="UnifiedAreaRect" Value="{{0.1,0},{0.1,0},{0.9,0},{0.29,0}}" />
Am I able to define variables so I can instead type something along the lines of:
variable1 = 0.1
variable2 = 0.1
variable3 = 0.9
variable4 = 0.29
Static Text 1....
<Property Name="UnifiedAreaRect" Value="{{variable1,0},{variable2,0},{variable3,0},{variable4,0}}" />
Furthermore, is it possible to modify these variables after existence? For example equivalent to:
variable2 += 0.1
variable4 += 0.1
Static Text 2....
<Property Name="UnifiedAreaRect" Value="{{variable1,0},{variable2,0},{variable3,0},{variable4,0}}" />
...resulting in the second text being placed below the first text. This would allow switching many text positions or adding new texts very easily instead of having to modify all the "magic numbers" for each position over and over again.
<Property Name="UnifiedAreaRect" Value="{{0.1,0},{0.1,0},{0.9,0},{0.29,0}}" />
Am I able to define variables so I can instead type something along the lines of:
variable1 = 0.1
variable2 = 0.1
variable3 = 0.9
variable4 = 0.29
Static Text 1....
<Property Name="UnifiedAreaRect" Value="{{variable1,0},{variable2,0},{variable3,0},{variable4,0}}" />
Furthermore, is it possible to modify these variables after existence? For example equivalent to:
variable2 += 0.1
variable4 += 0.1
Static Text 2....
<Property Name="UnifiedAreaRect" Value="{{variable1,0},{variable2,0},{variable3,0},{variable4,0}}" />
...resulting in the second text being placed below the first text. This would allow switching many text positions or adding new texts very easily instead of having to modify all the "magic numbers" for each position over and over again.