summaryrefslogtreecommitdiff
path: root/server/xml/macros/example.xml
blob: ce6e2c08764c1e445522181b963db25f0d9333d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?xml version='1.0' encoding='UTF-8'?>
<macro name="example" version="1.0" resume="${linse1}${linse2}">
  <queries>
    <query class="lensmeter" ttl="10000" automap="true"/>
  </queries>
  <maps>
    <map name="axis">
      -- LUA program
      return math.pi, 1234567890
    </map>
    <map name="right.axis" uses="lensmeter, lensmeter.right.axis">
      -- LUA program
	  right_axis = 0
	  if( lensmeter.right.axis ) right_axis = lensmeter.right.axis.value
      return right_axis, lensmeter.right.sphere.timestamp
    </map>
    <map name="cyl">
      -- LUA program
      return lensmeter.right.cyl.value, lensmeter.right.cyl.timestamp
    </map>
  </maps>
  <luaprograms>
    <luaprogram name="theanswer">
      fisk = getValue('sphere')
      if( tonumber(fisk) == tonumber(value) )
      then
        setValue('cyl', value)
        return true
      else
        return false
      end
    </luaprogram>
  </luaprograms>
  <window name="mainwindow"
          caption="Fundus"
          width="500"
          height="560"
          layout="vbox">
    <frame name="linse_frame" caption="Linser:" layout="vbox">
      <frame name="linse_framea" layout="hbox">
        <label name="a" width="300" caption="Akse rotation:"/>
        <lineedit name="axis" regexp="[24]*" map="axis" lua="theanswer" value="244"/>
      </frame>
      <frame name="linse_frameb" layout="hbox">
        <label name="b" width="300" caption="Sphere:"/>
        <lineedit name="sphere" regexp="[24]*" map="sphere" value="42"/>
      </frame>
      <frame name="linse_framec" layout="hbox">
        <label name="c" width="300" caption="Cyl:"/>
        <lineedit name="cyl" regexp="[24]*" map="cyl" value=""/>
      </frame>
    </frame>
    <frame name="buttons" layout="hbox">
      <button name="cancel" caption="Annuller" action="cancel"/>
      <button name="commit" caption="Godkend" action="commit"/>
    </frame>
  </window>
</macro>