diff --git a/Nasal/gui.nas b/Nasal/gui.nas index 3151dbaad..0508fa4fa 100644 --- a/Nasal/gui.nas +++ b/Nasal/gui.nas @@ -421,6 +421,22 @@ showTutorialDialog = func { showDialog(name); } +# Checks the /sim/weight[n]/{selected|opt} values and sets the +# appropriate weights therefrom. Called from the F&W dialog. +var setWeightOpts = func { + foreach(w; props.globals.getNode("sim").getChildren("weight")) { + var selected = w.getNode("selected"); + if(selected != nil) { + foreach(opt; w.getChildren("opt")) { + if(opt.getNode("name", 1).getValue() == selected.getValue()) { + var lbs = opt.getNode("lbs", 1).getValue(); + w.getNode("weight-lb", 1).setValue(lbs); + break; + } + } + } + } +} ## # Dynamically generates a weight & fuel configuration dialog specific to @@ -482,10 +498,10 @@ showWeightDialog = func { ok.setBinding("dialog-close"); # Temporary helper function - tcell = func { - cell = arg[0].addChild(arg[1]); - cell.set("row", arg[2]); - cell.set("col", arg[3]); + tcell = func(parent, type, row, col) { + cell = parent.addChild(type); + cell.set("row", row); + cell.set("col", col); return cell; } @@ -561,23 +577,58 @@ showWeightDialog = func { wgts = props.globals.getNode("/sim").getChildren("weight"); for(i=0; i