Instruments GUI: format value with Nasal
This commit is contained in:
parent
2ce60a3659
commit
c42da1014d
1 changed files with 20 additions and 2 deletions
|
@ -4,6 +4,24 @@
|
||||||
<modal>false</modal>
|
<modal>false</modal>
|
||||||
<layout>vbox</layout>
|
<layout>vbox</layout>
|
||||||
|
|
||||||
|
<nasal>
|
||||||
|
<open><![CDATA[
|
||||||
|
var update = func(){
|
||||||
|
setprop("/instrumentation/altimeter/setting-hpa-formatted", int(getprop("/instrumentation/altimeter/setting-hpa")));
|
||||||
|
setprop("/instrumentation/altimeter/setting-inhg-formatted", int(getprop("/instrumentation/altimeter/setting-inhg")*100.0)/100.0);
|
||||||
|
print('update');
|
||||||
|
}
|
||||||
|
var hpaListener = setlistener("/instrumentation/altimeter/setting-hpa", update);
|
||||||
|
var inhgListener = setlistener("/instrumentation/altimeter/setting-inhg", update);
|
||||||
|
update();
|
||||||
|
]]></open>
|
||||||
|
|
||||||
|
<close><![CDATA[
|
||||||
|
removelistener(hpaListener);
|
||||||
|
removelistener(inhgListener);
|
||||||
|
]]></close>
|
||||||
|
</nasal>
|
||||||
|
|
||||||
<group>
|
<group>
|
||||||
<layout>hbox</layout>
|
<layout>hbox</layout>
|
||||||
<empty><stretch>1</stretch></empty>
|
<empty><stretch>1</stretch></empty>
|
||||||
|
@ -67,7 +85,7 @@
|
||||||
<width>75</width>
|
<width>75</width>
|
||||||
<height>25</height>
|
<height>25</height>
|
||||||
<live>true</live>
|
<live>true</live>
|
||||||
<property>/instrumentation/altimeter/setting-hpa</property>
|
<property>/instrumentation/altimeter/setting-hpa-formatted</property>
|
||||||
<binding>
|
<binding>
|
||||||
<command>dialog-apply</command>
|
<command>dialog-apply</command>
|
||||||
</binding>
|
</binding>
|
||||||
|
@ -153,7 +171,7 @@
|
||||||
<width>75</width>
|
<width>75</width>
|
||||||
<height>25</height>
|
<height>25</height>
|
||||||
<live>true</live>
|
<live>true</live>
|
||||||
<property>/instrumentation/altimeter/setting-inhg</property>
|
<property>/instrumentation/altimeter/setting-inhg-formatted</property>
|
||||||
<binding>
|
<binding>
|
||||||
<command>dialog-apply</command>
|
<command>dialog-apply</command>
|
||||||
</binding>
|
</binding>
|
||||||
|
|
Loading…
Add table
Reference in a new issue