waypoints vbox 4 var dlg = props.globals.getNode("/sim/gui/dialogs/waypoints", 1); var selection = dlg.getNode("selection", 1); var input = dlg.getNode("input", 1); selection.setValue(""); input.setValue(""); var list = cmdarg().getNode("list"); var cmd = props.globals.getNode("/autopilot/route-manager/input", 1); var routemgr = props.globals.getNode("/autopilot/route-manager/route", 1); sel_index = func { var s = selection.getValue(); selection.setValue(""); return s == "" ? -1 : split(':', s)[0] - 1; } clear = func { cmd.setValue("@clear"); } insert = func { cmd.setValue("@insert" ~ sel_index() ~ ":" ~ input.getValue()); input.setValue(""); } remove = func { cmd.setValue("@delete" ~ sel_index()) } listchanged = func { list.removeChildren("value"); var wp = routemgr.getChildren("wp"); forindex (var i; wp) { var id = wp[i].getNode("id").getValue(); var name = wp[i].getNode("name").getValue(); var lon = wp[i].getNode("longitude-deg").getValue(); var lat = wp[i].getNode("latitude-deg").getValue(); var alt = wp[i].getNode("altitude-ft").getValue(); var entry = sprintf("%d: %-5s %3.2f lon %3.2f lat %.0f ft", i + 1, id, lon, lat, alt); list.getChild("value", i, 1).setValue(entry); } fgcommand("dialog-update", props.Node.new({"object-name": "list", "dialog-name": "waypoints"})); } var lst = setlistener("/autopilot/route-manager/route/num", listchanged, 1); removelistener(lst); hbox 2 Target: %s /autopilot/route-manager/wp[0]/id true Dist: %.2f nm /autopilot/route-manager/wp[0]/dist true ETA: %s /autopilot/route-manager/wp[0]/eta true list fill 150 /sim/gui/dialogs/waypoints/selection dialog-apply list hbox 4 60 input 220 /sim/gui/dialogs/waypoints/input 1 0.5 0.5 0.5 hbox fill 6 true