Mercurial > hg > octave-nkf
annotate scripts/gui/msgbox.m @ 20281:98d10871018a
Accept CREATEMODE argument for errordlg, warndlg, msgbox (bug #44775).
* errordlg.m: Update docstring. Use varargin to pass extra argument to msg_box.
* warndlg.m: Update docstring. Use varargin to pass extra argument to msg_box.
* msgbox.m: Update docstring.
* message_dialog.m: Issue warning if unimplemented CREATEMODE argument given.
Issue warning if icon type "custom" is used.
author | Rik <rik@octave.org> |
---|---|
date | Sat, 11 Apr 2015 08:18:42 -0700 |
parents | 0e1f5a750d00 |
children | 777f26aa8e3e |
rev | line source |
---|---|
17744
d63878346099
maint: Update copyright notices for release.
John W. Eaton <jwe@octave.org>
parents:
17700
diff
changeset
|
1 ## Copyright (C) 2010, 2013 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 |
da26f72408a7
update copyright statements in newly added java files
John W. Eaton <jwe@octave.org>
parents:
15709
diff
changeset
|
7 ## the Free Software Foundation; either version 3 of the License, or (at |
da26f72408a7
update copyright statements in newly added java files
John W. Eaton <jwe@octave.org>
parents:
15709
diff
changeset
|
8 ## your option) any later version. |
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 |
da26f72408a7
update copyright statements in newly added java files
John W. Eaton <jwe@octave.org>
parents:
15709
diff
changeset
|
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
da26f72408a7
update copyright statements in newly added java files
John W. Eaton <jwe@octave.org>
parents:
15709
diff
changeset
|
13 ## 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 -*- |
15772
0f1a143e5002
Overhaul scripts/java directory to conform to Octave core.
Rik <rik@octave.org>
parents:
15750
diff
changeset
|
20 ## @deftypefn {Function File} {@var{h} =} msgbox (@var{msg}) |
0f1a143e5002
Overhaul scripts/java directory to conform to Octave core.
Rik <rik@octave.org>
parents:
15750
diff
changeset
|
21 ## @deftypefnx {Function File} {@var{h} =} msgbox (@var{msg}, @var{title}) |
0f1a143e5002
Overhaul scripts/java directory to conform to Octave core.
Rik <rik@octave.org>
parents:
15750
diff
changeset
|
22 ## @deftypefnx {Function File} {@var{h} =} msgbox (@var{msg}, @var{title}, @var{icon}) |
20281
98d10871018a
Accept CREATEMODE argument for errordlg, warndlg, msgbox (bug #44775).
Rik <rik@octave.org>
parents:
19793
diff
changeset
|
23 ## @deftypefnx {Function File} {@var{h} =} msgbox (@dots{}, @var{createmode}) |
19790
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
24 ## Display @var{msg} using a message dialog box. |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
25 ## |
15748
54e8c2527a9e
style and doc fixes for newly imported Java package .m files
John W. Eaton <jwe@octave.org>
parents:
15746
diff
changeset
|
26 ## The message may have multiple lines separated by newline characters |
20281
98d10871018a
Accept CREATEMODE argument for errordlg, warndlg, msgbox (bug #44775).
Rik <rik@octave.org>
parents:
19793
diff
changeset
|
27 ## ("\n"), or it may be a cellstr array with one element for each |
15772
0f1a143e5002
Overhaul scripts/java directory to conform to Octave core.
Rik <rik@octave.org>
parents:
15750
diff
changeset
|
28 ## line. The optional input @var{title} (character string) can be used to |
15748
54e8c2527a9e
style and doc fixes for newly imported Java package .m files
John W. Eaton <jwe@octave.org>
parents:
15746
diff
changeset
|
29 ## decorate the dialog caption. |
15709
9fee0b741de6
Update Java dialog scrips to latest octave-forge status
Philip Nienhuis <prnienhuis@users.sf.net>
parents:
15625
diff
changeset
|
30 ## |
19790
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
31 ## The optional argument @var{icon} selects a dialog icon. |
17281
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
16512
diff
changeset
|
32 ## It can be one of @qcode{"none"} (default), @qcode{"error"}, |
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
16512
diff
changeset
|
33 ## @qcode{"help"}, or @qcode{"warn"}. |
15748
54e8c2527a9e
style and doc fixes for newly imported Java package .m files
John W. Eaton <jwe@octave.org>
parents:
15746
diff
changeset
|
34 ## |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
35 ## The return value is always 1. |
20281
98d10871018a
Accept CREATEMODE argument for errordlg, warndlg, msgbox (bug #44775).
Rik <rik@octave.org>
parents:
19793
diff
changeset
|
36 ## |
98d10871018a
Accept CREATEMODE argument for errordlg, warndlg, msgbox (bug #44775).
Rik <rik@octave.org>
parents:
19793
diff
changeset
|
37 ## Compatibility Note: The optional argument @var{createmode} is accepted for |
98d10871018a
Accept CREATEMODE argument for errordlg, warndlg, msgbox (bug #44775).
Rik <rik@octave.org>
parents:
19793
diff
changeset
|
38 ## @sc{matlab} compatibility, but is not implemented. |
98d10871018a
Accept CREATEMODE argument for errordlg, warndlg, msgbox (bug #44775).
Rik <rik@octave.org>
parents:
19793
diff
changeset
|
39 # |
15772
0f1a143e5002
Overhaul scripts/java directory to conform to Octave core.
Rik <rik@octave.org>
parents:
15750
diff
changeset
|
40 ## @seealso{errordlg, helpdlg, inputdlg, listdlg, questdlg, warndlg} |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
41 ## @end deftypefn |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
42 |
16508
f19e24c97b20
move common warndlg, errordlg, helpdlg, and msgbox code to private function
John W. Eaton <jwe@octave.org>
parents:
16505
diff
changeset
|
43 function retval = msgbox (msg, title = "", varargin) |
15772
0f1a143e5002
Overhaul scripts/java directory to conform to Octave core.
Rik <rik@octave.org>
parents:
15750
diff
changeset
|
44 |
20281
98d10871018a
Accept CREATEMODE argument for errordlg, warndlg, msgbox (bug #44775).
Rik <rik@octave.org>
parents:
19793
diff
changeset
|
45 if (nargin < 1 || nargin > 4) |
15772
0f1a143e5002
Overhaul scripts/java directory to conform to Octave core.
Rik <rik@octave.org>
parents:
15750
diff
changeset
|
46 print_usage (); |
0f1a143e5002
Overhaul scripts/java directory to conform to Octave core.
Rik <rik@octave.org>
parents:
15750
diff
changeset
|
47 endif |
15709
9fee0b741de6
Update Java dialog scrips to latest octave-forge status
Philip Nienhuis <prnienhuis@users.sf.net>
parents:
15625
diff
changeset
|
48 |
16508
f19e24c97b20
move common warndlg, errordlg, helpdlg, and msgbox code to private function
John W. Eaton <jwe@octave.org>
parents:
16505
diff
changeset
|
49 retval = message_dialog ("msgbox", msg, title, varargin{:}); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
50 |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
51 endfunction |
15772
0f1a143e5002
Overhaul scripts/java directory to conform to Octave core.
Rik <rik@octave.org>
parents:
15750
diff
changeset
|
52 |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16508
diff
changeset
|
53 |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16508
diff
changeset
|
54 %!demo |
17337
a31b54b5f84a
Use only 1 space between '%!' and start of test/demo code.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
55 %! disp('- test msgbox message only.'); |
a31b54b5f84a
Use only 1 space between '%!' and start of test/demo code.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
56 %! msgbox("Below, you should see 3 lines:\nline #1\nline #2, and\nline #3."); |
a31b54b5f84a
Use only 1 space between '%!' and start of test/demo code.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
57 |
a31b54b5f84a
Use only 1 space between '%!' and start of test/demo code.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
58 %!demo |
a31b54b5f84a
Use only 1 space between '%!' and start of test/demo code.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
59 %! disp('- test msgbox message and caption.'); |
a31b54b5f84a
Use only 1 space between '%!' and start of test/demo code.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
60 %! msgbox('You should see a single line.','A msgbox'); |
a31b54b5f84a
Use only 1 space between '%!' and start of test/demo code.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
61 |