checklist vbox 1 0.41 0.4 0.42 1.0 1.0 var dlgRoot = cmdarg(); var checklists = props.globals.getNode("/sim/checklists", 1).getChildren("checklist"); if (size(checklists) > 0) { var combo = gui.findElementByName(dlgRoot, "checklist-combo"); var group = gui.findElementByName(dlgRoot, "checklist-table-group"); forindex (var idx; checklists) { combo.getChild("value", idx, 1).setValue(checklists[idx].getNode("title", 1).getValue()); var c = checklists[idx]; var row = 0; # Set up a new table, only visible when this checklist is selected. var table = group.getChild("group", idx, 1); table.getNode("row", 1).setValue(0); table.getNode("col", 1).setValue(0); table.getNode("default-padding", 1).setValue(4); table.getNode("layout", 1).setValue("table"); table.getNode("valign", 1).setValue("top"); var vis = table.getNode("visible", 1).getNode("equals", 1); vis.getNode("property", 1).setValue("sim/gui/dialogs/checklist/selected-checklist"); vis.getNode("value", 1).setValue(c.getNode("title").getValue()); var items = c.getChildren("item"); var txtcount = 0; forindex (var i; items) { var item = items[i]; var t = table.getChild("text", txtcount, 1); txtcount += 1; var values = item.getChildren("value"); if (size(values) == 0) { # Single name element with no values. Used as title t.getNode("halign", 1).setValue("center"); t.getNode("row", 1).setValue(row); t.getNode("col", 1).setValue(0); t.getNode("colspan", 1).setValue(2); t.getNode("label", 1).setValue(item.getNode("name", 1).getValue()); row = row + 1; } else { t.getNode("halign", 1).setValue("left"); t.getNode("row", 1).setValue(row); t.getNode("col", 1).setValue(0); t.getNode("label", 1).setValue(item.getNode("name", 1).getValue()); forindex (var v; values) { var t = table.getChild("text", txtcount, 1); txtcount += 1; t.getNode("halign", 1).setValue("right"); t.getNode("row", 1).setValue(row); if (v > 0) { # The second row of values can overlap with the # first column if required - helps keep the # checklist dialog as compact as possible t.getNode("col", 1).setValue(0); t.getNode("colspan", 1).setValue(2); } else { t.getNode("col", 1).setValue(1); } t.getNode("label", 1).setValue(values[v].getValue()); # If there's a complete node, it contains a condition # that can be checked to ensure the checklist item is # complete. We display this item in yellow while the # condition is not met, and green once it is complete. var condition = item.getNode("condition"); if (condition != nil) { var vis = t.getNode("visible", 1); props.copy(condition, vis); var c = t.getNode("color", 1); c.getNode("red", 1).setValue(0.2); c.getNode("green", 1).setValue(1.0); c.getNode("blue", 1).setValue(0.2); # Now create an yellow version for when the condition # is not met. t = table.getChild("text", txtcount, 1); txtcount += 1; t.getNode("halign", 1).setValue("right"); t.getNode("row", 1).setValue(row); if (v > 0) { # The second row of values can overlap with the # first column if required - helps keep the # checklist dialog as compact as possible t.getNode("col", 1).setValue(0); t.getNode("colspan", 1).setValue(2); } else { t.getNode("col", 1).setValue(1); } t.getNode("label", 1).setValue(values[v].getValue()); c = t.getNode("color", 1); c.getNode("red", 1).setValue(1.0); c.getNode("green", 1).setValue(1.0); c.getNode("blue", 1).setValue(0.2); vis = t.getNode("visible", 1).getNode("not", 1); props.copy(condition, vis); } row = row + 1; } } } } setprop("sim/gui/dialogs/checklist/selected-checklist", checklists[0].getNode("title").getValue()); } else { var group = gui.findElementByName(dlgRoot, "checklist-table-group"); var table = group.getNode("text", 1); table.getNode("row", 1).setValue(0); table.getNode("col", 1).setValue(0); table.getNode("default-padding", 1).setValue(4); table.getNode("layout", 1).setValue("table"); table.getNode("valign", 1).setValue("top"); table.getNode("halign", 1).setValue("center"); table.getNode("label", 1).setValue("No checklists exist for this aircraft"); } var setTransparency = func(updateDialog){ var alpha = (getprop("/sim/gui/dialogs/checklist/transparent") or 0); dlgRoot.getNode("color/alpha").setValue(1-alpha*0.3); dlgRoot.getNode("color/red").setValue(0.41-alpha*0.2); dlgRoot.getNode("color/green").setValue(0.4-alpha*0.2); dlgRoot.getNode("color/blue").setValue(0.42-alpha*0.2); var n = props.Node.new({ "dialog-name": "checklist" }); if (updateDialog) { fgcommand("dialog-close", n); fgcommand("dialog-show", n); } } setTransparency(0); hbox 1 1 hbox right checklist-combo /sim/gui/dialogs/checklist/selected-checklist false 200 fill dialog-apply checklist-combo true 100 /sim/gui/dialogs/checklist/transparent true right dialog-apply property-toggle nasal 4 fill table checklist-table-group