comparison scripts/gui/warndlg.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} =} warndlg (@var{msg}) 20 ## @deftypefn {} {@var{h} =} warndlg ()
21 ## @deftypefnx {} {@var{h} =} warndlg (@var{msg})
21 ## @deftypefnx {} {@var{h} =} warndlg (@var{msg}, @var{title}) 22 ## @deftypefnx {} {@var{h} =} warndlg (@var{msg}, @var{title})
22 ## @deftypefnx {} {@var{h} =} warndlg (@var{msg}, @var{title}, @var{createmode}) 23 ## @deftypefnx {} {@var{h} =} warndlg (@var{msg}, @var{title}, @var{createmode})
23 ## Display @var{msg} using a warning dialog box. 24 ## Display warning message @var{msg} using a warning dialog box with caption
25 ## @var{title} (character string). The default warning message is
26 ## @qcode{"This is the default warning string."} and the default caption is
27 ## @qcode{"Warning Dialog"}.
24 ## 28 ##
25 ## The message may have multiple lines separated by newline characters ("\n"), 29 ## The warning 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{"Warning 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.
35 ## 37 ##
36 ## @seealso{helpdlg, inputdlg, listdlg, questdlg} 38 ## Examples:
39 ##
40 ## @example
41 ## @group
42 ## warndlg ("Some warning text for the user.");
43 ## warndlg ("Some warning text\nwith two lines.");
44 ## warndlg (@{"Some warning text", "with two lines."@});
45 ## warndlg ("Some warning text for the user.", "Fancy caption");
46 ## @end group
47 ## @end example
48 ##
49 ## @seealso{errordlg, helpdlg, inputdlg, listdlg, msgbox, questdlg}
37 ## @end deftypefn 50 ## @end deftypefn
38 51
39 function retval = warndlg (msg, title = "Warning Dialog", varargin) 52 function retval = warndlg (varargin)
40 53
41 if (nargin < 1 || nargin > 3) 54 narginchk (0, 3);
42 print_usage (); 55
56 box_msg = "This is the default warning string.";
57 box_title = "Warning 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 ("warndlg", msg, title, "warn", varargin{:}); 66 if (nargin < 3)
67 retval = msgbox (box_msg, box_title, "warn");
68 else
69 retval = msgbox (box_msg, box_title, "warn", varargin{3});
70 endif
46 71
47 endfunction 72 endfunction
48 73
49 74 %!error<narginchk> warndlg (1, 2, 3, 4)
50 %!demo 75 %!error<MSG must be a character string> warndlg (1)
51 %! disp ('- test warndlg with prompt only.'); 76 %!error<TITLE must be a character string> warndlg ("msg", 1)
52 %! warndlg ('Oh, a warning occurred');
53
54 %!demo
55 %! disp ('- test warndlg with prompt and caption.');
56 %! warndlg ('Oh, No...','This is the last Warning');
57