I've just started to get to grips with the XML schema. The verbose and repetitive nature of it cries out for the ability to call functions or subroutines. As far as I'm aware that's not possible, please correct me if that's wrong.
So I've created a tool to provide the ability to incorporate Functions into the code. I'm not sure of the protocol on this forum... shall I upload the tool for others to try? How do I do that?
When you're editing a gauge it only adds a single button click into the workflow. You create and edit a "source" file, from which the tool generates an "output" file. The output file is the one in the 'gauges' folder that the simulator uses.
Here's an example of a Source file, followed by the Output file that the tool generates. In the Source file note the <Function> structure near the bottom and the <Call> tags that call it.
Regards,
David
SOURCE FILE:
OUTPUT FILE:
So I've created a tool to provide the ability to incorporate Functions into the code. I'm not sure of the protocol on this forum... shall I upload the tool for others to try? How do I do that?
When you're editing a gauge it only adds a single button click into the workflow. You create and edit a "source" file, from which the tool generates an "output" file. The output file is the one in the 'gauges' folder that the simulator uses.
Here's an example of a Source file, followed by the Output file that the tool generates. In the Source file note the <Function> structure near the bottom and the <Call> tags that call it.
Regards,
David
SOURCE FILE:
Code:
<SimBase.Document Type="AceXML" version="1,0">
<Descr>AceXML Document</Descr>
<Filename>FunctionTest Source.xml</Filename>
<SimGauge.Gauge id="Test" ArtDirectory=".">
<Size>300,300</Size>
<Element id="Debug">
<FloatPosition>85,80</FloatPosition>
<GaugeText>
<Size>100,30</Size>
<GaugeString>Something</GaugeString>
<FontColor>0x111111</FontColor>
<FontFace>Consolas</FontFace>
<FontHeight>14</FontHeight>
<HorizontalAlign>Center</HorizontalAlign>
<Bright>True</Bright>
</GaugeText>
</Element>
<Call id="hLine1" name="HorizontalLine" top="100" left="100" scale="200 1000 /" colour="0xFFFFFF"/>
<Call id="hLine2" name="HorizontalLine" top="120" left="120" scale="180 1000 /" colour="0x00FFFF"/>
<Call id="hLine3" name="HorizontalLine" top="140" left="140" scale="160 1000 /" colour="0xFF00FF"/>
<Call id="hLine4" name="HorizontalLine" top="160" left="160" scale="140 1000 /" colour="0xFFFF00"/>
<Call id="hLine5" name="HorizontalLine" top="180" left="180" scale="120 1000 /" colour="0xFF0000"/>
<Call id="hLine6" name="HorizontalLine" top="200" left="200" scale="100 1000 /" colour="0x00FF00"/>
<Function name="HorizontalLine">
<Element id="@id">
<TopScript>@top</TopScript>
<LeftScript>@left</LeftScript>
<HorizontalLine>
<LineWidth>1</LineWidth>
<Width>1000</Width>
<SizeScaleScript>@scale</SizeScaleScript>
<LineColor>@colour</LineColor>
</HorizontalLine>
</Element>
</Function>
</SimGauge.Gauge>
</SimBase.Document>
OUTPUT FILE:
Code:
<SimBase.Document Type="AceXML" version="1,0">
<Descr>AceXML Document</Descr>
<Filename>FunctionTest Source.xml</Filename>
<SimGauge.Gauge id="Test" ArtDirectory=".">
<Size>300,300</Size>
<Element id="Debug">
<FloatPosition>85,80</FloatPosition>
<GaugeText>
<Size>100,30</Size>
<GaugeString>Something</GaugeString>
<FontColor>0x111111</FontColor>
<FontFace>Consolas</FontFace>
<FontHeight>14</FontHeight>
<HorizontalAlign>Center</HorizontalAlign>
<Bright>True</Bright>
</GaugeText>
</Element>
<Element id="hLine1">
<TopScript>100</TopScript>
<LeftScript>100</LeftScript>
<HorizontalLine>
<LineWidth>1</LineWidth>
<Width>1000</Width>
<SizeScaleScript>200 1000 /</SizeScaleScript>
<LineColor>0xFFFFFF</LineColor>
</HorizontalLine>
</Element>
<Element id="hLine2">
<TopScript>120</TopScript>
<LeftScript>120</LeftScript>
<HorizontalLine>
<LineWidth>1</LineWidth>
<Width>1000</Width>
<SizeScaleScript>180 1000 /</SizeScaleScript>
<LineColor>0x00FFFF</LineColor>
</HorizontalLine>
</Element>
<Element id="hLine3">
<TopScript>140</TopScript>
<LeftScript>140</LeftScript>
<HorizontalLine>
<LineWidth>1</LineWidth>
<Width>1000</Width>
<SizeScaleScript>160 1000 /</SizeScaleScript>
<LineColor>0xFF00FF</LineColor>
</HorizontalLine>
</Element>
<Element id="hLine4">
<TopScript>160</TopScript>
<LeftScript>160</LeftScript>
<HorizontalLine>
<LineWidth>1</LineWidth>
<Width>1000</Width>
<SizeScaleScript>140 1000 /</SizeScaleScript>
<LineColor>0xFFFF00</LineColor>
</HorizontalLine>
</Element>
<Element id="hLine5">
<TopScript>180</TopScript>
<LeftScript>180</LeftScript>
<HorizontalLine>
<LineWidth>1</LineWidth>
<Width>1000</Width>
<SizeScaleScript>120 1000 /</SizeScaleScript>
<LineColor>0xFF0000</LineColor>
</HorizontalLine>
</Element>
<Element id="hLine6">
<TopScript>200</TopScript>
<LeftScript>200</LeftScript>
<HorizontalLine>
<LineWidth>1</LineWidth>
<Width>1000</Width>
<SizeScaleScript>100 1000 /</SizeScaleScript>
<LineColor>0x00FF00</LineColor>
</HorizontalLine>
</Element>
</SimGauge.Gauge>
</SimBase.Document>