1
0
Fork 0

Use new Nasal parking data to populate a combo box for parking positions.

This commit is contained in:
James Turner 2012-04-25 16:10:28 +01:00
parent a1411ae7fd
commit 13c145a6d9

View file

@ -63,24 +63,33 @@
} }
var runways = dlg.getNode("available-runways", 1); var runways = dlg.getNode("available-runways", 1);
var parking = dlg.getNode("available-parking", 1);
var updateRunways = func { var updateAirport = func {
var icao = dlg.getNode("airport").getValue(); var icao = dlg.getNode("airport").getValue();
runways.removeChildren("value"); runways.removeChildren("value");
parking.removeChildren("value");
var apt = airportinfo(icao); var apt = airportinfo(icao);
if (apt != nil) { if (apt == nil) {
return;
}
var i=0; var i=0;
foreach (var rwy; keys(apt.runways)) { foreach (var rwy; keys(apt.runways)) {
runways.getNode("value[" ~ i ~ "]", 1).setValue(rwy); runways.getNode("value[" ~ i ~ "]", 1).setValue(rwy);
i += 1; i += 1;
} }
foreach (var park; apt.parking()) {
parking.getNode("value[" ~ i ~ "]", 1).setValue(park);
i += 1;
} }
gui.dialog_update("location-on-ground"); gui.dialog_update("location-on-ground");
} }
updateRunways(); updateAirport();
</open> </open>
</nasal> </nasal>
@ -103,7 +112,9 @@
</binding> </binding>
<binding> <binding>
<command>nasal</command> <command>nasal</command>
<script>updateRunways();</script> <script>
updateAirport();
</script>
</binding> </binding>
</input> </input>
@ -188,13 +199,21 @@
</enable> </enable>
</text> </text>
<input> <combo>
<name>parking</name>
<row>3</row><col>2</col> <row>3</row><col>2</col>
<pref-width>85</pref-width>
<enable> <enable>
<property>/sim/gui/dialogs/location-on-ground/use_parkpos</property> <property>/sim/gui/dialogs/location-on-ground/use_parkpos</property>
</enable> </enable>
<property>/sim/gui/dialogs/location-on-ground/parkpos</property> <property>/sim/gui/dialogs/location-on-ground/parkpos</property>
</input> <editable>false</editable>
<properties>sim/gui/dialogs/location-on-ground/available-parking</properties>
<binding>
<command>dialog-apply</command>
<object-name>parking</object-name>
</binding>
</combo>
</group> </group>
<hrule/> <hrule/>