1
0
Fork 0

Synchronize current Transponder ID code and Digit inputs on opening Dialog

Signed-off-by: Vivian Meazza <vivian.meazza@lineone.net>
This commit is contained in:
Vivian Meazza 2013-05-15 21:38:24 +01:00
parent c309f35468
commit 5ed97555db

View file

@ -12,6 +12,18 @@
var modes = ['OFF', 'STANDBY', 'TEST', 'GROUND', 'ON', 'ALTITUDE'];
var v = getprop('/instrumentation/transponder/inputs/knob-mode');
setprop("/sim/gui/dialogs/radios/transponder-mode", modes[v]);
var poweroften = [1, 10, 100, 1000];
var idcode = getprop('/instrumentation/transponder/id-code');
if (idcode != nil)
{
for (var i = 0; i < 4 ; i = i+1)
{
setprop("/instrumentation/transponder/inputs/digit[" ~ i ~ "]", math.mod(idcode/poweroften[i], 10) );
}
}
]]>
</open>
</nasal>
@ -20,13 +32,17 @@
<group>
<layout>hbox</layout>
<empty><stretch>1</stretch></empty>
<empty>
<stretch>1</stretch>
</empty>
<text>
<label>Radio Frequencies</label>
</text>
<empty><stretch>1</stretch></empty>
<empty>
<stretch>1</stretch>
</empty>
<button>
<pref-width>16</pref-width>
@ -579,7 +595,8 @@
</binding>
</button>
</group> <!-- of TACAN group -->
</group>
<!-- of TACAN group -->
<!-- transponder controls -->
@ -668,7 +685,9 @@
</binding>
</combo>
<empty><stretch>true</stretch></empty>
<empty>
<stretch>true</stretch>
</empty>
<text>
@ -693,13 +712,15 @@
</binding>
<binding>
<command>nasal</command>
<script><![CDATA[
<script>
<![CDATA[
var v = getprop("/sim/gui/dialogs/radios/transponder-mode");
#var modes = ['OFF', 'STANDBY', 'TEST', 'GROUND', 'ON', 'ALTITUDE'];
var index=0;
for (; index<size(modes) and (v != modes[index]); index+=1) { }
setprop("/instrumentation/transponder/inputs/knob-mode", index);
]]></script>
]]>
</script>
</binding>
</combo>
@ -710,7 +731,8 @@
<command>dialog-apply</command>
</binding>
</button>
</group> <!-- Transponder group -->
</group>
<!-- Transponder group -->
<!-- bottom button box -->
<hrule/>