location-on-ground
vbox
hbox
1
1
var dlg = props.globals.getNode("/sim/gui/dialogs/location-on-ground", 1);
var apt = dlg.getNode("airport", 1);
var aptname = dlg.getNode("airport-name", 1);
apt.setValue(getprop("/sim/presets/airport-id"));
var rwy = dlg.getNode("runway", 1);
rwy.setValue("");
var parkpos = dlg.getNode("parkpos", 1);
parkpos.setValue("");
var mode = {
runway: dlg.getNode("use_runway", 1),
bestrunway: dlg.getNode("use_best_runway", 1),
parkpos: dlg.getNode("use_parkpos", 1)
};
var set_radio = func(m) {
foreach (k; keys(mode)) {
mode[k].setBoolValue(m == k);
}
}
var initialized = 0;
foreach (k; keys(mode)) {
if (mode[k].getType() == "NONE" or initialized) {
mode[k].setBoolValue(0);
} else {
initialized += mode[k].getBoolValue();
}
}
if (!initialized) {
set_radio("bestrunway");
}
var runways = dlg.getNode("available-runways", 1);
var parking = dlg.getNode("available-parking", 1);
var updateAirport = func {
var icao = apt.getValue();
runways.removeChildren("value");
parking.removeChildren("value");
var a = airportinfo(icao);
if (a == nil) {
aptname.setValue("");
return;
}
aptname.setValue(a.name);
var i=0;
foreach (var rwy; keys(a.runways)) {
runways.getNode("value[" ~ i ~ "]", 1).setValue(rwy);
i += 1;
}
i = 0;
foreach (var park; a.parking()) {
parking.getNode("value[" ~ i ~ "]", 1).setValue(park.name);
i += 1;
}
gui.dialog_update("location-on-ground");
}
updateAirport();
table
center
0
1
right
0
2
true
/sim/gui/dialogs/location-on-ground/airport
dialog-apply
nasal
1
1
%s
/sim/gui/dialogs/location-on-ground/airport-name
true
true
fill
2
0
/sim/gui/dialogs/location-on-ground/use_best_runway
true
nasal
2
1
right
/sim/gui/dialogs/location-on-ground/use_best_runway
2
2
right
/sim/gui/dialogs/location-on-ground/use_best_runway
3
0
/sim/gui/dialogs/location-on-ground/use_runway
true
nasal
3
1
right
/sim/gui/dialogs/location-on-ground/use_runway
runway
3
2
85
/sim/gui/dialogs/location-on-ground/use_runway
sim/gui/dialogs/location-on-ground/runway
false
sim/gui/dialogs/location-on-ground/available-runways
dialog-apply
runway
4
0
/sim/gui/dialogs/location-on-ground/use_parkpos
true
nasal
4
1
right
/sim/gui/dialogs/location-on-ground/use_parkpos
parking
4
2
85
/sim/gui/dialogs/location-on-ground/use_parkpos
/sim/gui/dialogs/location-on-ground/parkpos
false
sim/gui/dialogs/location-on-ground/available-parking
dialog-apply
parking
hbox
10
true
true
true