- move dialog registration to the Dialog class
- fix documentation
This commit is contained in:
parent
baa037fe7e
commit
75a2b57a83
2 changed files with 5 additions and 6 deletions
|
@ -187,7 +187,7 @@ Dialog = {
|
||||||
|
|
||||||
m.listener = setlistener("/sim/signals/reinit-gui", func { m.load() }, 1);
|
m.listener = setlistener("/sim/signals/reinit-gui", func { m.load() }, 1);
|
||||||
}
|
}
|
||||||
return m;
|
return Dialog.instance[m.name] = m;
|
||||||
},
|
},
|
||||||
# doesn't need to be called explicitly, but can be used to force a reload
|
# doesn't need to be called explicitly, but can be used to force a reload
|
||||||
load : func {
|
load : func {
|
||||||
|
@ -232,11 +232,12 @@ Dialog = {
|
||||||
is_open : func {
|
is_open : func {
|
||||||
me.state;
|
me.state;
|
||||||
},
|
},
|
||||||
|
instance : {},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
##
|
##
|
||||||
# Open file select dialog (subclass of the Dialog class).
|
# FileSelector class (derived from Dialog class).
|
||||||
#
|
#
|
||||||
# SYNOPSIS: FileSelector.new(<callback> [, <oper> [, <dir> [, <file> [, <hidden>]]])
|
# SYNOPSIS: FileSelector.new(<callback> [, <oper> [, <dir> [, <file> [, <hidden>]]])
|
||||||
#
|
#
|
||||||
|
@ -249,7 +250,7 @@ Dialog = {
|
||||||
# EXAMPLE:
|
# EXAMPLE:
|
||||||
#
|
#
|
||||||
# var report = func { print("file ", cmdarg().getValue(), " selected") }
|
# var report = func { print("file ", cmdarg().getValue(), " selected") }
|
||||||
# var selector = gui.FileSelector(report, "Save Flight", "/tmp", "flight.sav");
|
# var selector = gui.FileSelector.new(report, "Save Flight", "/tmp", "flight.sav");
|
||||||
# selector.open(); # see the Dialog class for other methods
|
# selector.open(); # see the Dialog class for other methods
|
||||||
#
|
#
|
||||||
var FileSelector = {
|
var FileSelector = {
|
||||||
|
@ -263,7 +264,6 @@ var FileSelector = {
|
||||||
data.getNode("selection", 1).setValue(file);
|
data.getNode("selection", 1).setValue(file);
|
||||||
data.getNode("show-hidden", 1).setBoolValue(show_hidden);
|
data.getNode("show-hidden", 1).setBoolValue(show_hidden);
|
||||||
m.cblistener = setlistener(data.getNode("path", 1), callback);
|
m.cblistener = setlistener(data.getNode("path", 1), callback);
|
||||||
FileSelector.instance[name] = m;
|
|
||||||
return m;
|
return m;
|
||||||
},
|
},
|
||||||
del : func {
|
del : func {
|
||||||
|
@ -272,7 +272,6 @@ var FileSelector = {
|
||||||
removelistener(me.cblistener);
|
removelistener(me.cblistener);
|
||||||
me.prop.getParent().removeChild(me.prop.getName(), me.prop.getIndex());
|
me.prop.getParent().removeChild(me.prop.getName(), me.prop.getIndex());
|
||||||
},
|
},
|
||||||
instance : {},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -198,7 +198,7 @@
|
||||||
|
|
||||||
var close = func {
|
var close = func {
|
||||||
var err = [];
|
var err = [];
|
||||||
call(func { gui.FileSelector.instance[dlgname].close() }, nil, err);
|
call(func { gui.Dialog.instance[dlgname].close() }, nil, err);
|
||||||
}
|
}
|
||||||
|
|
||||||
var ok = func {
|
var ok = func {
|
||||||
|
|
Loading…
Add table
Reference in a new issue