mp-display
false
vbox
var dlg_root = cmdarg();
var update = func() {
print("Updating");
#fgcommand("dialog-update", dlg_root);
fgcommand("dialog-new", dlg_root);
#fgcommand("dialog-show", dlg_root);
}
var findElementByName = func(rootN, name) {
foreach( var child; rootN.getChildren() ) {
var n = child.getNode( "name" );
if( n != nil and n.getValue() == name )
return child;
var f = findElementByName(child,name);
if( f != nil ) return f;
}
return nil;
};
var resetDialog = func(root) {
print("resetDialog called " ~ root.getPath());
var classes = props.globals.getNode("/sim/multiplay/display").getChildren("usage-class");
var combo = findElementByName( root, "usage-class-selection" );
forindex (var i; classes) {
combo.getChild("value", i, 1).setValue(classes[i].getNode("name").getValue());
}
var display = findElementByName( root, "usage-class-display" );
forindex (var i; classes) {
# We don't allow users to display the "Ignore" class.
if (classes[i].getNode("name").getValue() != "Ignore") {
var check = display.getChild("checkbox", i, 1);
check.getNode("row", 1).setValue(i + 1);
check.getNode("col", 1).setValue(1);
check.getNode("property", 1).setValue(classes[i].getNode("visible").getPath());
#check.getNode("value", 1).setValue(classes[i].
#check.getNode("live", 1).setValue(1);
var text = display.getChild("text", i, 1);
text.getNode("row", 1).setValue(i + 1);
text.getNode("col", 1).setValue(2);
text.getNode("halign", 1).setValue("left");
text.getNode("label", 1).setValue(classes[i].getNode("name").getValue());
}
}
}
resetDialog(dlg_root);
hbox
hbox
hbox
left
usage-class-selection
fill
true
sim/multiplay/usage-class
dialog-apply
usage-class-selection
nasal
hbox
hbox
left
table
center
usage-class-display
top
hbox
left
add
true
fill
true
20
/sim/multiplay/new-usage-class
hbox
left
errormsg
hbox