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>
|
||||
<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>
|
||||
<layout>hbox</layout>
|
||||
<empty><stretch>1</stretch></empty>
|
||||
|
@ -67,7 +85,7 @@
|
|||
<width>75</width>
|
||||
<height>25</height>
|
||||
<live>true</live>
|
||||
<property>/instrumentation/altimeter/setting-hpa</property>
|
||||
<property>/instrumentation/altimeter/setting-hpa-formatted</property>
|
||||
<binding>
|
||||
<command>dialog-apply</command>
|
||||
</binding>
|
||||
|
@ -153,7 +171,7 @@
|
|||
<width>75</width>
|
||||
<height>25</height>
|
||||
<live>true</live>
|
||||
<property>/instrumentation/altimeter/setting-inhg</property>
|
||||
<property>/instrumentation/altimeter/setting-inhg-formatted</property>
|
||||
<binding>
|
||||
<command>dialog-apply</command>
|
||||
</binding>
|
||||
|
|
Loading…
Add table
Reference in a new issue