From 75a2b57a83ea5c90e59510d429b505c572f72870 Mon Sep 17 00:00:00 2001 From: mfranz Date: Fri, 15 Jun 2007 16:22:13 +0000 Subject: [PATCH] - move dialog registration to the Dialog class - fix documentation --- Nasal/gui.nas | 9 ++++----- gui/dialogs/file-select.xml | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Nasal/gui.nas b/Nasal/gui.nas index 1808c98fb..85a4a5d09 100644 --- a/Nasal/gui.nas +++ b/Nasal/gui.nas @@ -187,7 +187,7 @@ Dialog = { 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 load : func { @@ -232,11 +232,12 @@ Dialog = { is_open : func { me.state; }, + instance : {}, }; ## -# Open file select dialog (subclass of the Dialog class). +# FileSelector class (derived from Dialog class). # # SYNOPSIS: FileSelector.new( [, [, [, [, ]]]) # @@ -249,7 +250,7 @@ Dialog = { # EXAMPLE: # # 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 # var FileSelector = { @@ -263,7 +264,6 @@ var FileSelector = { data.getNode("selection", 1).setValue(file); data.getNode("show-hidden", 1).setBoolValue(show_hidden); m.cblistener = setlistener(data.getNode("path", 1), callback); - FileSelector.instance[name] = m; return m; }, del : func { @@ -272,7 +272,6 @@ var FileSelector = { removelistener(me.cblistener); me.prop.getParent().removeChild(me.prop.getName(), me.prop.getIndex()); }, - instance : {}, }; diff --git a/gui/dialogs/file-select.xml b/gui/dialogs/file-select.xml index d4b26ddf9..590b99aa7 100644 --- a/gui/dialogs/file-select.xml +++ b/gui/dialogs/file-select.xml @@ -198,7 +198,7 @@ var close = func { var err = []; - call(func { gui.FileSelector.instance[dlgname].close() }, nil, err); + call(func { gui.Dialog.instance[dlgname].close() }, nil, err); } var ok = func {