1
0
Fork 0

#441: overlay dialog must be reinitialized after reloading GUI

This commit is contained in:
ThorstenB 2011-09-18 12:36:40 +02:00
parent fa7c100289
commit 9195b36005

View file

@ -411,24 +411,29 @@ var OverlaySelector = {
m.sortprop = relpath(sortprop or nameprop); m.sortprop = relpath(sortprop or nameprop);
m.mpprop = mpprop; m.mpprop = mpprop;
m.callback = callback; m.callback = callback;
m.title = title;
m.dialog_name = name;
m.result = data.initNode("result", ""); m.result = data.initNode("result", "");
m.listener = setlistener(m.result, func(n) m.select(n.getValue())); m.listener = setlistener(m.result, func(n) m.select(n.getValue()));
m.prop.getNode("group/text/label").setValue(title);
m.prop.getNode("group/button/binding/script").setValue('gui.Dialog.instance["' ~ name ~ '"].close()');
m.list = m.prop.getNode("list");
m.list.getNode("property").setValue(m.result.getPath());
if (m.mpprop != nil) if (m.mpprop != nil)
aircraft.data.add(m.nameprop); aircraft.data.add(m.nameprop);
m.reinit();
m.rescan(); # need to reinit again, whenever the GUI is reloaded
m.current = -1; m.reinit_listener = setlistener("/sim/signals/reinit-gui", func(n) m.reinit());
m.select(getprop(m.nameprop) or "");
return m; return m;
}, },
reinit: func {
me.prop.getNode("group/text/label").setValue(me.title);
me.prop.getNode("group/button/binding/script").setValue('gui.Dialog.instance["' ~ me.dialog_name ~ '"].close()');
me.list = me.prop.getNode("list");
me.list.getNode("property").setValue(me.result.getPath());
me.rescan();
me.current = -1;
me.select(getprop(me.nameprop) or "");
},
del: func { del: func {
removelistener(me.listener); removelistener(me.listener);
removelistener(me.reinit_listener);
}, },
rescan: func { rescan: func {
me.data = []; me.data = [];