blob: f875747baa9c4d2dcbbec4cda0c6d9694949d34d (
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
<?xml version='1.0' encoding='UTF-8'?>
<macro name="example" version="1.0" resume="Axis: ${axis}\nCylinder: ${cyl}\nSphere: ${sphere}\n">
<queries>
<query class="lensmeter" ttl="10000" automap="true"/>
</queries>
<maps>
<map name="axis">
-- LUA program
return math.pi, 1234567890
</map>
<map name="cyl">
-- Returning 0, 0 invalidates the result
value = 0
timestamp = 0
-- Check for the existence of each level.
if( lensmeter and
lensmeter.right and
lensmeter.right.cyl and
lensmeter.right.cyl.value and
lensmeter.right.cyl.timestamp )
then
timestamp = lensmeter.right.cyl.value
value = lensmeter.right.cyl.value end
end
end
return value, timestamp
</map>
</maps>
<luaprograms>
<luaprogram name="theanswer">
sphere = tonumber(getValue('sphere'))
axis = tonumber(getValue('axis'))
if( sphere == axis )
then
setValue('cyl', name)
return true
else
return false
end
</luaprogram>
</luaprograms>
<window name="mainwindow"
caption="Example Window"
width="300"
height="400"
layout="vbox">
<frame name="linse_frame" caption="Linser:" layout="vbox">
<frame name="linse_framea" layout="hbox">
<label name="a" width="100" 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="100" caption="Sphere:"/>
<lineedit name="sphere" regexp="[24]*" lua="theanswer" value="42"/>
</frame>
<frame name="linse_framec" layout="hbox">
<label name="c" width="100" caption="Cyl:"/>
<lineedit name="cyl" regexp="[24]*" map="cyl" value=""/>
</frame>
</frame>
<frame name="linse_frame" caption="FlereLinser:" layout="vbox">
<frame name="linse_framea" layout="hbox">
<label name="a" width="100" caption="Akse rotation2:"/>
<lineedit name="axis2" regexp="[24]*" map="axis" lua="theanswer" value="244"/>
</frame>
<frame name="linse_frameb" layout="hbox">
<label name="b" width="100" caption="Sphere2:"/>
<lineedit name="sphere2" regexp="[24]*" lua="theanswer" value="42"/>
</frame>
<frame name="linse_framec" layout="hbox">
<label name="c" width="100" caption="Cyl2:"/>
<lineedit name="cyl2" 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>
|