Mercurial > hg > octave-lyh
comparison scripts/java/msgbox.m @ 15748:54e8c2527a9e
style and doc fixes for newly imported Java package .m files
* java/cell2mlstr.m, java/errordlg.m, java/helpdlg.m, java/inputdlg.m,
java/javaArray.m, java/javaaddpath.m, java/javaclasspath.m,
java/javafields.m, java/javamem.m, java/javamethods.m,
java/javarmpath.m, java/listdlg.m, java/msgbox.m java/questdlg.m,
java/warndlg.m: Style and doc fixes.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 07 Dec 2012 17:21:27 -0500 |
parents | da26f72408a7 |
children | 05c781cca57e |
comparison
equal
deleted
inserted
replaced
15747:4be890c5527c | 15748:54e8c2527a9e |
---|---|
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 {Function file} {@var{P} =} msgbox (@var{MESSAGE} [,@var{TITLE} [,@var{ICON}]]) | 20 ## @deftypefn {Function file} {@var{p} =} msgbox (@var{msg}, @var{title}, @var{ICON}) |
21 ## Display @var{msg} using a message dialog. | |
21 ## | 22 ## |
22 ## Displays the @var{MESSAGE} using a message dialog. | 23 ## The message may have multiple lines separated by newline characters |
24 ## (@code{"\n"}), or it may be a cellstr array with one element for each | |
25 ## line. The optional @var{title} (character string) can be used to | |
26 ## decorate the dialog caption. | |
23 ## | 27 ## |
24 ## @var{message} can have multiple lines separated by newline characters | 28 ## The optional argument @var{icon} selects a dialog icon. |
25 ## ("\n"), or it can be a cellstr array (one element for each line). | 29 ## It can be one of @code{"error"}, @code{"help"} or @code{"warn"}. |
26 ## The optional @var{TITLE} (character string) can be used to decorate the | 30 ## |
27 ## dialog caption. | |
28 ## The @var{ICON} can be used optionally to select a dialog icon. | |
29 ## It can be one of @code{'error'}, @code{'help'} or @code{'warn'}. | |
30 ## The return value is always 1. | 31 ## The return value is always 1. |
31 ## | 32 ## @seealso{helpdlg, questdlg, warndlg} |
32 ## @end deftypefn | 33 ## @end deftypefn |
33 ## @seealso{helpdlg, questdlg, warndlg} | |
34 | 34 |
35 function ret = msgbox (message, varargin) | 35 function retval = msgbox (message, varargin) |
36 | 36 |
37 if (! ischar (message)) | 37 if (! ischar (message)) |
38 if (iscell (message)) | 38 if (iscell (message)) |
39 message = cell2mlstr (message); | 39 message = cell2mlstr (message); |
40 else | 40 else |
43 endif | 43 endif |
44 | 44 |
45 switch length (varargin) | 45 switch length (varargin) |
46 case 0 | 46 case 0 |
47 title = ""; | 47 title = ""; |
48 dlg = 'emptydlg'; | 48 dlg = "emptydlg"; |
49 | |
49 case 1 | 50 case 1 |
50 title = varargin{1}; | 51 title = varargin{1}; |
51 dlg = 'emptydlg'; | 52 dlg = "emptydlg"; |
53 | |
52 otherwise | 54 otherwise |
53 % two or more arguments | 55 ## two or more arguments |
54 title = varargin{1}; | 56 title = varargin{1}; |
55 icon = varargin{2}; | 57 icon = varargin{2}; |
56 if strcmp (icon,'error') == 1 | 58 if (strcmp (icon, "error")) |
57 dlg = 'errordlg'; | 59 dlg = "errordlg"; |
58 elseif strcmp (icon,'help') == 1 | 60 elseif (strcmp (icon, "help")) |
59 dlg = 'helpdlg'; | 61 dlg = "helpdlg"; |
60 elseif strcmp (icon,'warn') == 1 | 62 elseif (strcmp (icon, "warn")) |
61 dlg = 'warndlg'; | 63 dlg = "warndlg"; |
62 else | 64 else |
63 dlg = 'emptydlg'; | 65 dlg = "emptydlg"; |
64 end | 66 end |
65 endswitch | 67 endswitch |
66 | 68 |
67 if (! ischar (title)) | 69 if (! ischar (title)) |
68 error ("msgbox: character string expected for title"); | 70 error ("msgbox: character string expected for title"); |
69 endif | 71 endif |
70 | 72 |
71 ret = java_invoke ('org.octave.JDialogBox', dlg, message, title ); | 73 retval = java_invoke ("org.octave.JDialogBox", dlg, message, title ); |
72 | 74 |
73 endfunction | 75 endfunction |