<?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
            
      return value, timestamp
    </map>
  </maps>
  <scripts>
    <script language="lua" name="theanswer">
      sphere = tonumber(getValue('sphere'))
      axis = tonumber(getValue('axis'))
      if( sphere == axis )
      then
        setValue('cyl', name)
        return true
      else
        return false
      end
    </script>
  </scripts>
  <window name="mainwindow"
          caption="Example Window"
          width="400"
          height="500"
          layout="vbox">
    <frame name="linse_frame" caption="Linser:" layout="vbox">
      <frame name="linse_framea" layout="hbox">
        <icon src="righteye"/>
        <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">
        <icon src="lefteye"/>
        <label name="b" width="100" caption="Sphere:"/>
      </frame>
      <frame name="linse_framec" layout="hbox">
        <label name="c" width="100" caption="Cyl:"/>
        <lineedit name="cyl" regexp=".*" map="cyl" value=""/>
      </frame>
    </frame>
    <frame name="linse_frame" caption="FlereLinser:" layout="vbox">
      <multilist name="multilisttest" value="" layout="vbox" format="Sphere: ${spherecombo}, Cyl: ${multcyl}.">
        <frame name="linse_frameb" layout="hbox">
          <label name="b" width="100" caption="Sphere:"/>
	  <combobox name="spherecombo" width="100" value="val_lad" type="search">
	    <item caption="sap" value="val_sap"/>
	    <item caption="sat" value="val_sat"/>
	    <item caption="sad" value="val_sad"/>
	    <item caption="rat" value="val_rat"/>
	    <item caption="rap" value="val_rap"/>
	    <item caption="ram" value="val_ram"/>
	    <item caption="rag" value="val_rag"/>
	    <item caption="nap" value="val_nap"/>
	    <item caption="Nat" value="val_Nat"/>
	    <item caption="mat" value="val_mat"/>
	    <item caption="map" value="val_map"/>
	    <item caption="mad" value="val_mad"/>
	    <item caption="lap" value="val_lap"/>
	    <item caption="lag" value="val_lag"/>
	    <item caption="lad" value="val_lad"/>
	    <item caption="fat" value="val_fat"/>
	    <item caption="fan" value="val_fan"/>
	    <item caption="fad" value="val_fad"/>
	    <item caption="fin" value="val_fin"/>
	    <item caption="fit" value="val_fit"/>
	    <item caption="lid" value="val_lid"/>
	    <item caption="lip" value="val_lip"/>
	    <item caption="lit" value="val_lit"/>
	    <item caption="mid" value="val_mid"/>
	    <item caption="mit" value="val_mit"/>
	    <item caption="nit" value="val_nit"/>
	    <item caption="nip" value="val_nip"/>
	    <item caption="rid" value="val_rid"/>
	    <item caption="rig" value="val_rig"/>
	    <item caption="rim" value="val_rim"/>
	    <item caption="rip" value="val_rip"/>
	    <item caption="Sid" value="val_Sid"/>
	    <item caption="sin" value="val_sin"/>
	    <item caption="sip" value="val_sip"/>
	    <item caption="log" value="val_log"/>
	    <item caption="mom" value="val_mom"/>
	    <item caption="mop" value="val_mop"/>
	    <item caption="nod" value="val_nod"/>
	    <item caption="rod" value="val_rod"/>
	    <item caption="Ron" value="val_Ron"/>
	    <item caption="rot" value="val_rot"/>
	    <item caption="sod" value="val_sod"/>
	    <item caption="fun" value="val_fun"/>
	    <item caption="mud" value="val_mud"/>
	    <item caption="mum" value="val_mum"/>
	    <item caption="nut" value="val_nut"/>
	    <item caption="rug" value="val_rug"/>
	    <item caption="rut" value="val_rut"/>
	    <item caption="sum" value="val_sum"/>
	    <item caption="sun" value="val_sun"/>
	    <item caption="fed" value="val_fed"/>
	    <item caption="led" value="val_led"/>
	    <item caption="leg" value="val_leg"/>
	    <item caption="met" value="val_met"/>
	    <item caption="Ned" value="val_Ned"/>
	    <item caption="net" value="val_net"/>
	    <item caption="bag" value="val_bag"/>
	    <item caption="bad" value="val_bad"/>
	    <item caption="bam" value="val_bam"/>
	  </combobox>
        </frame>
        <frame name="linse_framec" layout="hbox">
          <label name="c" width="100" caption="Cyl:"/>
          <lineedit name="multcyl" width="100" regexp=".*" value=""/>
        </frame>
      </multilist>
    </frame>
    <frame name="buttons" layout="hbox">
      <button name="cancel" caption="Annuller" action="cancel"/>
      <button name="commit" caption="Godkend" action="commit"/>
    </frame>
  </window>
</macro>