comparison scripts/gui/errordlg.m @ 21630:b5d9b95d1e1a

Removing Java dialog boxes. * scripts/gui/module.mk: removed message_dialog.m entry. * scripts/gui/private/message_dialog.m: merged code to msgbox. * scripts/gui/errordlg.m: function now redirects to msgbox. New tests. * scripts/gui/helpdlg.m: function now redirects to msgbox. New tests. * scripts/gui/warndlg.m: function now redirects to msgbox. New tests. * scripts/gui/msgbox.m: merged code from message_dialog. Stripped Java dialog boxes. New tests. * scripts/gui/inputdlg.m: stripped Java dialog boxes. Improved doc. New tests. * scripts/gui/listdlg.m: stripped Java dialog boxes. Improved doc. New tests. * scripts/gui/questdlg.m: stripped Java dialog boxes. Improved doc. New tests. * scripts/miscellaneous/menu.m: stripped Java dialog boxes. Improved doc. * scripts/java/module.mk: removed entries of deleted files. * scripts/java/org/octave/DlgListener.java: removed Java dialog box Listener. * scripts/java/org/octave/images/error.png: removed unused image. * scripts/java/org/octave/images/information.png: removed unused image. * scripts/java/org/octave/images/octave.png: removed unused image. * scripts/java/org/octave/images/question.png: removed unused image. * scripts/java/org/octave/images/warning.png: removed unused image. * scripts/java/org/octave/JDialogBox.java: removed Java dialog box class. * scripts/java/org/octave/TeXcode.java: removed class used by Java dialogs. * scripts/java/org/octave/TeXtranslator.java: removed class used by Java dialogs. * doc/module.mk: removed unused java images and java.txi. * doc/interpreter/java.txi: merged content as minor sections to following files. * doc/interpreter/bugs.txi: moved Java distinguish section here. * doc/interpreter/external.txi: moved Java Interface description here. * doc/interpreter/gui.txi: moved dialog box docstrings here. * doc/interpreter/octave.texi: corrected TOC. * doc/interpreter/java-images/image001.png: removed unused image. * doc/interpreter/java-images/image002.png: removed unused image. * doc/interpreter/java-images/image003.png: removed unused image. * doc/interpreter/java-images/image004.png: removed unused image. * doc/interpreter/java-images/image005.png: removed unused image. * doc/interpreter/java-images/image006.png: removed unused image. * doc/interpreter/java-images/image007.png: removed unused image. * doc/interpreter/java-images/image008.png: removed unused image. * doc/interpreter/java-images/image009.png: removed unused image. * NEWS: Announced changes.
author Kai T. Ohlhus <k.ohlhus@gmail.com>
date Tue, 19 Apr 2016 15:27:19 +0200
parents 936b88598a0b
children 59ebef9680ef
comparison
equal deleted inserted replaced
21629:9958cead45e2 21630:b5d9b95d1e1a
15 ## You should have received a copy of the GNU General Public License 15 ## You should have received a copy of the GNU General Public License
16 ## along with Octave; see the file COPYING. If not, see 16 ## along with Octave; see the file COPYING. If not, see
17 ## <http://www.gnu.org/licenses/>. 17 ## <http://www.gnu.org/licenses/>.
18 18
19 ## -*- texinfo -*- 19 ## -*- texinfo -*-
20 ## @deftypefn {} {@var{h} =} errordlg (@var{msg}) 20 ## @deftypefn {} {@var{h} =} errordlg ()
21 ## @deftypefnx {} {@var{h} =} errordlg (@var{msg})
21 ## @deftypefnx {} {@var{h} =} errordlg (@var{msg}, @var{title}) 22 ## @deftypefnx {} {@var{h} =} errordlg (@var{msg}, @var{title})
22 ## @deftypefnx {} {@var{h} =} errordlg (@var{msg}, @var{title}, @var{createmode}) 23 ## @deftypefnx {} {@var{h} =} errordlg (@var{msg}, @var{title}, @var{createmode})
23 ## Display @var{msg} using an error dialog box. 24 ## Display an error message @var{msg} using an error dialog box with caption
25 ## @var{title} (character string). The default error message is
26 ## @qcode{"This is the default error string."} and the default caption is
27 ## @qcode{"Error Dialog"}.
24 ## 28 ##
25 ## The message may have multiple lines separated by newline characters ("\n"), 29 ## The error message may have multiple lines separated by newline characters
26 ## or it may be a cellstr array with one element for each line. 30 ## ("\n"), or it may be a cellstr array with one element for each line.
27 ## 31 ##
28 ## The optional input @var{title} (character string) can be used to set the 32 ## The return value @var{h} is always 1.
29 ## dialog caption. The default title is @qcode{"Error Dialog"}.
30 ##
31 ## The return value is always 1.
32 ## 33 ##
33 ## Compatibility Note: The optional argument @var{createmode} is accepted for 34 ## Compatibility Note: The optional argument @var{createmode} is accepted for
34 ## @sc{matlab} compatibility, but is not implemented. 35 ## @sc{matlab} compatibility, but is not implemented. See @code{msgbox} for
36 ## details.
37 ##
38 ## Examples:
39 ##
40 ## @example
41 ## @group
42 ## errordlg ("Some fancy error occured.");
43 ## errordlg ("Some fancy error\nwith two lines.");
44 ## errordlg (@{"Some fancy error", "with two lines."@});
45 ## errordlg ("Some fancy error occured.", "Fancy caption");
46 ## @end group
47 ## @end example
35 ## 48 ##
36 ## @seealso{helpdlg, inputdlg, listdlg, msgbox, questdlg, warndlg} 49 ## @seealso{helpdlg, inputdlg, listdlg, msgbox, questdlg, warndlg}
37 ## @end deftypefn 50 ## @end deftypefn
38 51
39 function retval = errordlg (msg, title = "Error Dialog", varargin) 52 function retval = errordlg (varargin)
40 53
41 if (nargin < 1 || nargin > 3) 54 narginchk (0, 3);
42 print_usage (); 55
56 box_msg = "This is the default error string.";
57 box_title = "Error Dialog";
58
59 if (nargin > 0)
60 box_msg = varargin{1};
61 endif
62 if (nargin > 1)
63 box_title = varargin{2};
43 endif 64 endif
44 65
45 retval = message_dialog ("errordlg", msg, title, "error", varargin{:}); 66 if (nargin < 3)
67 retval = msgbox (box_msg, box_title, "error");
68 else
69 retval = msgbox (box_msg, box_title, "error", varargin{3});
70 endif
46 71
47 endfunction 72 endfunction
48 73
49 74 %!error<narginchk> errordlg (1, 2, 3, 4)
50 %!demo 75 %!error<MSG must be a character string> errordlg (1)
51 %! disp ('- test errordlg with prompt only.'); 76 %!error<TITLE must be a character string> errordlg ("msg", 1)
52 %! errordlg ('Oops, an expected error occurred');
53
54 %!demo
55 %! disp ('- test errordlg with prompt and caption.');
56 %! errordlg ('Oops another error','This is a very long and informative caption');
57