1
0
Fork 0

When loading a dialog, first close it, then remove the whole branch,

then load, and finally open the dialog again if it was open at the
beginning. That way it's easy to edit and to update a Nasal-loaded
XML dialog.
This commit is contained in:
mfranz 2007-03-25 10:00:53 +00:00
parent 7a300fca3e
commit c09c7ac5c6

View file

@ -172,6 +172,11 @@ Dialog = {
},
# doesn't need to be called explicitly, but can be used to force a reload
load : func {
var state = me.state;
if (state) {
me.close();
}
me.prop.removeChildren();
fgcommand("loadxml", props.Node.new({"filename": me.path,
"targetnode": me.prop.getPath()}));
var n = me.prop.getNode("name");
@ -181,6 +186,9 @@ Dialog = {
me.name = n.getValue();
me.prop.getNode("dialog-name", 1).setValue(me.name);
fgcommand("dialog-new", me.prop);
if (state) {
me.open();
}
},
# allows access to dialog-embedded Nasal variables/functions
namespace : func {