Mercurial > octave
annotate scripts/gui/errordlg.m @ 23084:ef4d915df748
maint: Merge stable to default.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 23 Jan 2017 14:27:48 -0500 |
parents | 3a2b891d0b33 e9a0469dedd9 |
children | 092078913d54 |
rev | line source |
---|---|
22323
bac0d6f07a3e
maint: Update copyright notices for 2016.
John W. Eaton <jwe@octave.org>
parents:
21637
diff
changeset
|
1 ## Copyright (C) 2010-2016 Martin Hepperle |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
2 ## |
15746
da26f72408a7
update copyright statements in newly added java files
John W. Eaton <jwe@octave.org>
parents:
15709
diff
changeset
|
3 ## This file is part of Octave. |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
4 ## |
15746
da26f72408a7
update copyright statements in newly added java files
John W. Eaton <jwe@octave.org>
parents:
15709
diff
changeset
|
5 ## Octave is free software; you can redistribute it and/or modify it |
da26f72408a7
update copyright statements in newly added java files
John W. Eaton <jwe@octave.org>
parents:
15709
diff
changeset
|
6 ## under the terms of the GNU General Public License as published by |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
7 ## the Free Software Foundation; either version 3 of the License, or |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
8 ## (at your option) any later version. |
15746
da26f72408a7
update copyright statements in newly added java files
John W. Eaton <jwe@octave.org>
parents:
15709
diff
changeset
|
9 ## |
da26f72408a7
update copyright statements in newly added java files
John W. Eaton <jwe@octave.org>
parents:
15709
diff
changeset
|
10 ## Octave is distributed in the hope that it will be useful, but |
da26f72408a7
update copyright statements in newly added java files
John W. Eaton <jwe@octave.org>
parents:
15709
diff
changeset
|
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
13 ## GNU General Public License for more details. |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
14 ## |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
15 ## You should have received a copy of the GNU General Public License |
15746
da26f72408a7
update copyright statements in newly added java files
John W. Eaton <jwe@octave.org>
parents:
15709
diff
changeset
|
16 ## along with Octave; see the file COPYING. If not, see |
da26f72408a7
update copyright statements in newly added java files
John W. Eaton <jwe@octave.org>
parents:
15709
diff
changeset
|
17 ## <http://www.gnu.org/licenses/>. |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
18 |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
19 ## -*- texinfo -*- |
21630
b5d9b95d1e1a
Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21005
diff
changeset
|
20 ## @deftypefn {} {@var{h} =} errordlg () |
b5d9b95d1e1a
Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21005
diff
changeset
|
21 ## @deftypefnx {} {@var{h} =} errordlg (@var{msg}) |
20852
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20173
diff
changeset
|
22 ## @deftypefnx {} {@var{h} =} errordlg (@var{msg}, @var{title}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20173
diff
changeset
|
23 ## @deftypefnx {} {@var{h} =} errordlg (@var{msg}, @var{title}, @var{createmode}) |
21637
59ebef9680ef
More cleanup associated with removing Java dialog boxes (cset b5d9b95d1e1a).
Rik <rik@octave.org>
parents:
21630
diff
changeset
|
24 ## Display an error dialog box with error message @var{msg} and caption |
59ebef9680ef
More cleanup associated with removing Java dialog boxes (cset b5d9b95d1e1a).
Rik <rik@octave.org>
parents:
21630
diff
changeset
|
25 ## @var{title}. |
59ebef9680ef
More cleanup associated with removing Java dialog boxes (cset b5d9b95d1e1a).
Rik <rik@octave.org>
parents:
21630
diff
changeset
|
26 ## |
59ebef9680ef
More cleanup associated with removing Java dialog boxes (cset b5d9b95d1e1a).
Rik <rik@octave.org>
parents:
21630
diff
changeset
|
27 ## The default error message is @qcode{"This is the default error string."} and |
59ebef9680ef
More cleanup associated with removing Java dialog boxes (cset b5d9b95d1e1a).
Rik <rik@octave.org>
parents:
21630
diff
changeset
|
28 ## the default caption is @qcode{"Error Dialog"}. |
20173
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
20071
diff
changeset
|
29 ## |
21630
b5d9b95d1e1a
Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21005
diff
changeset
|
30 ## The error message may have multiple lines separated by newline characters |
b5d9b95d1e1a
Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21005
diff
changeset
|
31 ## ("\n"), or it may be a cellstr array with one element for each line. |
15748
54e8c2527a9e
style and doc fixes for newly imported Java package .m files
John W. Eaton <jwe@octave.org>
parents:
15746
diff
changeset
|
32 ## |
21630
b5d9b95d1e1a
Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21005
diff
changeset
|
33 ## The return value @var{h} is always 1. |
20071
98d10871018a
Accept CREATEMODE argument for errordlg, warndlg, msgbox (bug #44775).
Rik <rik@octave.org>
parents:
17745
diff
changeset
|
34 ## |
98d10871018a
Accept CREATEMODE argument for errordlg, warndlg, msgbox (bug #44775).
Rik <rik@octave.org>
parents:
17745
diff
changeset
|
35 ## Compatibility Note: The optional argument @var{createmode} is accepted for |
21630
b5d9b95d1e1a
Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21005
diff
changeset
|
36 ## @sc{matlab} compatibility, but is not implemented. See @code{msgbox} for |
b5d9b95d1e1a
Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21005
diff
changeset
|
37 ## details. |
b5d9b95d1e1a
Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21005
diff
changeset
|
38 ## |
b5d9b95d1e1a
Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21005
diff
changeset
|
39 ## Examples: |
b5d9b95d1e1a
Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21005
diff
changeset
|
40 ## |
b5d9b95d1e1a
Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21005
diff
changeset
|
41 ## @example |
b5d9b95d1e1a
Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21005
diff
changeset
|
42 ## @group |
21637
59ebef9680ef
More cleanup associated with removing Java dialog boxes (cset b5d9b95d1e1a).
Rik <rik@octave.org>
parents:
21630
diff
changeset
|
43 ## errordlg ("Some fancy error occurred."); |
21630
b5d9b95d1e1a
Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21005
diff
changeset
|
44 ## errordlg ("Some fancy error\nwith two lines."); |
b5d9b95d1e1a
Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21005
diff
changeset
|
45 ## errordlg (@{"Some fancy error", "with two lines."@}); |
21637
59ebef9680ef
More cleanup associated with removing Java dialog boxes (cset b5d9b95d1e1a).
Rik <rik@octave.org>
parents:
21630
diff
changeset
|
46 ## errordlg ("Some fancy error occurred.", "Fancy caption"); |
21630
b5d9b95d1e1a
Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21005
diff
changeset
|
47 ## @end group |
b5d9b95d1e1a
Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21005
diff
changeset
|
48 ## @end example |
20071
98d10871018a
Accept CREATEMODE argument for errordlg, warndlg, msgbox (bug #44775).
Rik <rik@octave.org>
parents:
17745
diff
changeset
|
49 ## |
15772
0f1a143e5002
Overhaul scripts/java directory to conform to Octave core.
Rik <rik@octave.org>
parents:
15750
diff
changeset
|
50 ## @seealso{helpdlg, inputdlg, listdlg, msgbox, questdlg, warndlg} |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
51 ## @end deftypefn |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
52 |
21630
b5d9b95d1e1a
Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21005
diff
changeset
|
53 function retval = errordlg (varargin) |
b5d9b95d1e1a
Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21005
diff
changeset
|
54 |
b5d9b95d1e1a
Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21005
diff
changeset
|
55 narginchk (0, 3); |
15772
0f1a143e5002
Overhaul scripts/java directory to conform to Octave core.
Rik <rik@octave.org>
parents:
15750
diff
changeset
|
56 |
21637
59ebef9680ef
More cleanup associated with removing Java dialog boxes (cset b5d9b95d1e1a).
Rik <rik@octave.org>
parents:
21630
diff
changeset
|
57 msg = "This is the default error string."; |
59ebef9680ef
More cleanup associated with removing Java dialog boxes (cset b5d9b95d1e1a).
Rik <rik@octave.org>
parents:
21630
diff
changeset
|
58 title = "Error Dialog"; |
21630
b5d9b95d1e1a
Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21005
diff
changeset
|
59 |
b5d9b95d1e1a
Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21005
diff
changeset
|
60 if (nargin > 0) |
21637
59ebef9680ef
More cleanup associated with removing Java dialog boxes (cset b5d9b95d1e1a).
Rik <rik@octave.org>
parents:
21630
diff
changeset
|
61 msg = varargin{1}; |
21630
b5d9b95d1e1a
Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21005
diff
changeset
|
62 endif |
b5d9b95d1e1a
Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21005
diff
changeset
|
63 if (nargin > 1) |
21637
59ebef9680ef
More cleanup associated with removing Java dialog boxes (cset b5d9b95d1e1a).
Rik <rik@octave.org>
parents:
21630
diff
changeset
|
64 title = varargin{2}; |
15772
0f1a143e5002
Overhaul scripts/java directory to conform to Octave core.
Rik <rik@octave.org>
parents:
15750
diff
changeset
|
65 endif |
15709
9fee0b741de6
Update Java dialog scrips to latest octave-forge status
Philip Nienhuis <prnienhuis@users.sf.net>
parents:
15625
diff
changeset
|
66 |
21630
b5d9b95d1e1a
Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21005
diff
changeset
|
67 if (nargin < 3) |
21637
59ebef9680ef
More cleanup associated with removing Java dialog boxes (cset b5d9b95d1e1a).
Rik <rik@octave.org>
parents:
21630
diff
changeset
|
68 retval = msgbox (msg, title, "error"); |
21630
b5d9b95d1e1a
Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21005
diff
changeset
|
69 else |
21637
59ebef9680ef
More cleanup associated with removing Java dialog boxes (cset b5d9b95d1e1a).
Rik <rik@octave.org>
parents:
21630
diff
changeset
|
70 retval = msgbox (msg, title, "error", varargin{3}); |
21630
b5d9b95d1e1a
Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21005
diff
changeset
|
71 endif |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
72 |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
73 endfunction |
15772
0f1a143e5002
Overhaul scripts/java directory to conform to Octave core.
Rik <rik@octave.org>
parents:
15750
diff
changeset
|
74 |
21637
59ebef9680ef
More cleanup associated with removing Java dialog boxes (cset b5d9b95d1e1a).
Rik <rik@octave.org>
parents:
21630
diff
changeset
|
75 |
59ebef9680ef
More cleanup associated with removing Java dialog boxes (cset b5d9b95d1e1a).
Rik <rik@octave.org>
parents:
21630
diff
changeset
|
76 %!error errordlg (1, 2, 3, 4) |
59ebef9680ef
More cleanup associated with removing Java dialog boxes (cset b5d9b95d1e1a).
Rik <rik@octave.org>
parents:
21630
diff
changeset
|
77 %!error <MSG must be a character string> errordlg (1) |
59ebef9680ef
More cleanup associated with removing Java dialog boxes (cset b5d9b95d1e1a).
Rik <rik@octave.org>
parents:
21630
diff
changeset
|
78 %!error <TITLE must be a character string> errordlg ("msg", 1) |