Mercurial > hg > octave-lyh
diff scripts/java/errordlg.m @ 15709:9fee0b741de6
Update Java dialog scrips to latest octave-forge status
* dlgtest.m: strip away all code for reinstalling Java package
* cell2mlstr.m: new function
* helpdlg.m, errordlg.m, inputdlg.m, listdlg.m, questdlg.m, warndlg.m, msgbox.m:
Allow cellstr arrays as first argument (ML compatibilility)
author | Philip Nienhuis <prnienhuis@users.sf.net> |
---|---|
date | Sat, 01 Dec 2012 18:10:55 +0100 |
parents | acf0addfc610 |
children | da26f72408a7 |
line wrap: on
line diff
--- a/scripts/java/errordlg.m +++ b/scripts/java/errordlg.m @@ -16,22 +16,35 @@ ## -*- texinfo -*- ## @deftypefn {Function file} {@var{P} =} errordlg (@var{MESSAGE} [,@var{TITLE}]) ## -## Displays the @var{MESSAGE} using an error dialog box. -## The @var{TITLE} can be used optionally to decorate the dialog caption. +## Displays the @var{MESSAGE} (character string or cell string array for +## multi-line text) using an error dialog box. +## @var{TITLE} can be used optionally to decorate the dialog caption. ## The return value is always 1. ## ## @end deftypefn ## @seealso{helpdlg, inputdlg, listdlg, questdlg, warndlg} -function ret = errordlg(message,varargin) - +function ret = errordlg (message, varargin) + + if (! ischar (message)) + if (iscell (message)) + message = cell2mlstr (message); + else + error ("errordlg: character string or cellstr array expected for message"); + endif + endif + switch length (varargin) case 0 - title = "Error Dialog"; + title = "Error Dialog"; otherwise - title = varargin{1}; + title = varargin{1}; endswitch + if (! ischar (title)) + error ("errordlg: character string expected for title"); + endif + ret = java_invoke ("org.octave.JDialogBox", "errordlg", message, title); endfunction