Mercurial > octave
annotate scripts/gui/inputdlg.m @ 29358:0a5b15007766 stable
update Octave Project Developers copyright for the new year
In files that have the "Octave Project Developers" copyright notice,
update for 2021.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 10 Feb 2021 09:52:15 -0500 |
parents | c20b7290c778 |
children | a7981aa5822b |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 ######################################################################## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 ## |
29358
0a5b15007766
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
27957
diff
changeset
|
3 ## Copyright (C) 2010-2021 The Octave Project Developers |
27918
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
27263
diff
changeset
|
4 ## |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 ## See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 ## distribution or <https://octave.org/copyright/>. |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
7 ## |
15746
da26f72408a7
update copyright statements in newly added java files
John W. Eaton <jwe@octave.org>
parents:
15709
diff
changeset
|
8 ## 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
|
9 ## |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
10 ## Octave is free software: you can redistribute it and/or modify it |
15746
da26f72408a7
update copyright statements in newly added java files
John W. Eaton <jwe@octave.org>
parents:
15709
diff
changeset
|
11 ## under the terms of the GNU General Public License as published by |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
12 ## the Free Software Foundation, either version 3 of the License, or |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22737
diff
changeset
|
13 ## (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
|
14 ## |
da26f72408a7
update copyright statements in newly added java files
John W. Eaton <jwe@octave.org>
parents:
15709
diff
changeset
|
15 ## 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
|
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22737
diff
changeset
|
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22737
diff
changeset
|
18 ## 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
|
19 ## |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
20 ## 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
|
21 ## along with Octave; see the file COPYING. If not, see |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
22 ## <https://www.gnu.org/licenses/>. |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 ## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 ######################################################################## |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
25 |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
26 ## -*- texinfo -*- |
20852
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20173
diff
changeset
|
27 ## @deftypefn {} {@var{cstr} =} inputdlg (@var{prompt}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20173
diff
changeset
|
28 ## @deftypefnx {} {@var{cstr} =} inputdlg (@var{prompt}, @var{title}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20173
diff
changeset
|
29 ## @deftypefnx {} {@var{cstr} =} inputdlg (@var{prompt}, @var{title}, @var{rowscols}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20173
diff
changeset
|
30 ## @deftypefnx {} {@var{cstr} =} inputdlg (@var{prompt}, @var{title}, @var{rowscols}, @var{defaults}) |
22530
db762b9b9b72
inputdlg.m: proper rowcols handling and accept options parameter (bug #49143)
Avinoam Kalma <a.kalma@gmail.com>
parents:
22323
diff
changeset
|
31 ## @deftypefnx {} {@var{cstr} =} inputdlg (@var{prompt}, @var{title}, @var{rowscols}, @var{defaults}, @var{options}) |
20173
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19952
diff
changeset
|
32 ## Return user input from a multi-textfield dialog box in a cell array of |
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19952
diff
changeset
|
33 ## strings, or an empty cell array if the dialog is closed by the Cancel |
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19952
diff
changeset
|
34 ## button. |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
35 ## |
15772
0f1a143e5002
Overhaul scripts/java directory to conform to Octave core.
Rik <rik@octave.org>
parents:
15750
diff
changeset
|
36 ## Inputs: |
0f1a143e5002
Overhaul scripts/java directory to conform to Octave core.
Rik <rik@octave.org>
parents:
15750
diff
changeset
|
37 ## |
15748
54e8c2527a9e
style and doc fixes for newly imported Java package .m files
John W. Eaton <jwe@octave.org>
parents:
15746
diff
changeset
|
38 ## @table @var |
54e8c2527a9e
style and doc fixes for newly imported Java package .m files
John W. Eaton <jwe@octave.org>
parents:
15746
diff
changeset
|
39 ## @item prompt |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
40 ## A cell array with strings labeling each text field. This input is required. |
15772
0f1a143e5002
Overhaul scripts/java directory to conform to Octave core.
Rik <rik@octave.org>
parents:
15750
diff
changeset
|
41 ## |
15748
54e8c2527a9e
style and doc fixes for newly imported Java package .m files
John W. Eaton <jwe@octave.org>
parents:
15746
diff
changeset
|
42 ## @item title |
20173
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19952
diff
changeset
|
43 ## String to use for the caption of the dialog. The default is |
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19952
diff
changeset
|
44 ## @qcode{"Input Dialog"}. |
15772
0f1a143e5002
Overhaul scripts/java directory to conform to Octave core.
Rik <rik@octave.org>
parents:
15750
diff
changeset
|
45 ## |
15748
54e8c2527a9e
style and doc fixes for newly imported Java package .m files
John W. Eaton <jwe@octave.org>
parents:
15746
diff
changeset
|
46 ## @item rowscols |
15772
0f1a143e5002
Overhaul scripts/java directory to conform to Octave core.
Rik <rik@octave.org>
parents:
15750
diff
changeset
|
47 ## Specifies the size of the text fields and can take three forms: |
0f1a143e5002
Overhaul scripts/java directory to conform to Octave core.
Rik <rik@octave.org>
parents:
15750
diff
changeset
|
48 ## |
15748
54e8c2527a9e
style and doc fixes for newly imported Java package .m files
John W. Eaton <jwe@octave.org>
parents:
15746
diff
changeset
|
49 ## @enumerate |
26035
0a39db17170c
doc: Clean up docstrings for XXXdlg.m functions
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
50 ## @item a scalar value which defines the number of rows used for each text |
0a39db17170c
doc: Clean up docstrings for XXXdlg.m functions
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
51 ## field. |
15772
0f1a143e5002
Overhaul scripts/java directory to conform to Octave core.
Rik <rik@octave.org>
parents:
15750
diff
changeset
|
52 ## |
26035
0a39db17170c
doc: Clean up docstrings for XXXdlg.m functions
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
53 ## @item a vector which defines the individual number of rows used for each |
0a39db17170c
doc: Clean up docstrings for XXXdlg.m functions
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
54 ## text field. |
15772
0f1a143e5002
Overhaul scripts/java directory to conform to Octave core.
Rik <rik@octave.org>
parents:
15750
diff
changeset
|
55 ## |
26035
0a39db17170c
doc: Clean up docstrings for XXXdlg.m functions
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
56 ## @item a matrix which defines the individual number of rows and columns used |
0a39db17170c
doc: Clean up docstrings for XXXdlg.m functions
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
57 ## for each text field. In the matrix each row describes a single text field. |
0a39db17170c
doc: Clean up docstrings for XXXdlg.m functions
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
58 ## The first column specifies the number of input rows to use and the second |
0a39db17170c
doc: Clean up docstrings for XXXdlg.m functions
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
59 ## column specifies the text field width. |
15748
54e8c2527a9e
style and doc fixes for newly imported Java package .m files
John W. Eaton <jwe@octave.org>
parents:
15746
diff
changeset
|
60 ## @end enumerate |
15772
0f1a143e5002
Overhaul scripts/java directory to conform to Octave core.
Rik <rik@octave.org>
parents:
15750
diff
changeset
|
61 ## |
15748
54e8c2527a9e
style and doc fixes for newly imported Java package .m files
John W. Eaton <jwe@octave.org>
parents:
15746
diff
changeset
|
62 ## @item defaults |
26035
0a39db17170c
doc: Clean up docstrings for XXXdlg.m functions
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
63 ## A list of default values to place in each text field. It must be a cell |
20173
777f26aa8e3e
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19952
diff
changeset
|
64 ## array of strings with the same size as @var{prompt}. |
22530
db762b9b9b72
inputdlg.m: proper rowcols handling and accept options parameter (bug #49143)
Avinoam Kalma <a.kalma@gmail.com>
parents:
22323
diff
changeset
|
65 ## |
db762b9b9b72
inputdlg.m: proper rowcols handling and accept options parameter (bug #49143)
Avinoam Kalma <a.kalma@gmail.com>
parents:
22323
diff
changeset
|
66 ## @item options |
db762b9b9b72
inputdlg.m: proper rowcols handling and accept options parameter (bug #49143)
Avinoam Kalma <a.kalma@gmail.com>
parents:
22323
diff
changeset
|
67 ## Not supported, only for @sc{matlab} compatibility. |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
68 ## @end table |
21630
b5d9b95d1e1a
Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21178
diff
changeset
|
69 ## |
b5d9b95d1e1a
Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21178
diff
changeset
|
70 ## Example: |
b5d9b95d1e1a
Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21178
diff
changeset
|
71 ## |
b5d9b95d1e1a
Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21178
diff
changeset
|
72 ## @example |
b5d9b95d1e1a
Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21178
diff
changeset
|
73 ## @group |
b5d9b95d1e1a
Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21178
diff
changeset
|
74 ## prompt = @{"Width", "Height", "Depth"@}; |
b5d9b95d1e1a
Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21178
diff
changeset
|
75 ## defaults = @{"1.10", "2.20", "3.30"@}; |
b5d9b95d1e1a
Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21178
diff
changeset
|
76 ## rowscols = [1,10; 2,20; 3,30]; |
26577
ae1542fb58ba
documentation: Avoid some overfull lines in the PDF manual.
Markus Mützel <markus.muetzel@gmx.de>
parents:
26376
diff
changeset
|
77 ## dims = inputdlg (prompt, "Enter Box Dimensions", ... |
ae1542fb58ba
documentation: Avoid some overfull lines in the PDF manual.
Markus Mützel <markus.muetzel@gmx.de>
parents:
26376
diff
changeset
|
78 ## rowscols, defaults); |
21630
b5d9b95d1e1a
Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21178
diff
changeset
|
79 ## @end group |
b5d9b95d1e1a
Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21178
diff
changeset
|
80 ## @end example |
b5d9b95d1e1a
Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21178
diff
changeset
|
81 ## |
15772
0f1a143e5002
Overhaul scripts/java directory to conform to Octave core.
Rik <rik@octave.org>
parents:
15750
diff
changeset
|
82 ## @seealso{errordlg, helpdlg, listdlg, msgbox, questdlg, warndlg} |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
83 ## @end deftypefn |
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
84 |
21630
b5d9b95d1e1a
Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21178
diff
changeset
|
85 function cstr = inputdlg (prompt, varargin) |
15772
0f1a143e5002
Overhaul scripts/java directory to conform to Octave core.
Rik <rik@octave.org>
parents:
15750
diff
changeset
|
86 |
22530
db762b9b9b72
inputdlg.m: proper rowcols handling and accept options parameter (bug #49143)
Avinoam Kalma <a.kalma@gmail.com>
parents:
22323
diff
changeset
|
87 narginchk (1, 5); |
15709
9fee0b741de6
Update Java dialog scrips to latest octave-forge status
Philip Nienhuis <prnienhuis@users.sf.net>
parents:
15625
diff
changeset
|
88 |
9fee0b741de6
Update Java dialog scrips to latest octave-forge status
Philip Nienhuis <prnienhuis@users.sf.net>
parents:
15625
diff
changeset
|
89 if (iscell (prompt)) |
15748
54e8c2527a9e
style and doc fixes for newly imported Java package .m files
John W. Eaton <jwe@octave.org>
parents:
15746
diff
changeset
|
90 ## Silently extract only char elements |
17386
6dbc866379e2
Replace cellfun() occurrences with faster code where possible.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
91 prompt = prompt(cellfun ("isclass", prompt, "char")); |
15709
9fee0b741de6
Update Java dialog scrips to latest octave-forge status
Philip Nienhuis <prnienhuis@users.sf.net>
parents:
15625
diff
changeset
|
92 elseif (ischar (prompt)) |
9fee0b741de6
Update Java dialog scrips to latest octave-forge status
Philip Nienhuis <prnienhuis@users.sf.net>
parents:
15625
diff
changeset
|
93 prompt = {prompt}; |
9fee0b741de6
Update Java dialog scrips to latest octave-forge status
Philip Nienhuis <prnienhuis@users.sf.net>
parents:
15625
diff
changeset
|
94 else |
21637
59ebef9680ef
More cleanup associated with removing Java dialog boxes (cset b5d9b95d1e1a).
Rik <rik@octave.org>
parents:
21630
diff
changeset
|
95 error ("inputdlg: PROMPT must be a character string or cellstr array"); |
15709
9fee0b741de6
Update Java dialog scrips to latest octave-forge status
Philip Nienhuis <prnienhuis@users.sf.net>
parents:
15625
diff
changeset
|
96 endif |
9fee0b741de6
Update Java dialog scrips to latest octave-forge status
Philip Nienhuis <prnienhuis@users.sf.net>
parents:
15625
diff
changeset
|
97 |
21637
59ebef9680ef
More cleanup associated with removing Java dialog boxes (cset b5d9b95d1e1a).
Rik <rik@octave.org>
parents:
21630
diff
changeset
|
98 title = "Input Dialog"; |
21630
b5d9b95d1e1a
Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21178
diff
changeset
|
99 if (nargin > 1) |
21637
59ebef9680ef
More cleanup associated with removing Java dialog boxes (cset b5d9b95d1e1a).
Rik <rik@octave.org>
parents:
21630
diff
changeset
|
100 if (! ischar (varargin{1})) |
59ebef9680ef
More cleanup associated with removing Java dialog boxes (cset b5d9b95d1e1a).
Rik <rik@octave.org>
parents:
21630
diff
changeset
|
101 error ("inputdlg: TITLE must be a character string"); |
21630
b5d9b95d1e1a
Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21178
diff
changeset
|
102 endif |
21637
59ebef9680ef
More cleanup associated with removing Java dialog boxes (cset b5d9b95d1e1a).
Rik <rik@octave.org>
parents:
21630
diff
changeset
|
103 title = varargin{1}; |
21630
b5d9b95d1e1a
Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21178
diff
changeset
|
104 endif |
15748
54e8c2527a9e
style and doc fixes for newly imported Java package .m files
John W. Eaton <jwe@octave.org>
parents:
15746
diff
changeset
|
105 |
21630
b5d9b95d1e1a
Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21178
diff
changeset
|
106 linespec = 1; |
b5d9b95d1e1a
Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21178
diff
changeset
|
107 if (nargin > 2) |
b5d9b95d1e1a
Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21178
diff
changeset
|
108 linespec = varargin{2}; |
b5d9b95d1e1a
Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21178
diff
changeset
|
109 endif |
15748
54e8c2527a9e
style and doc fixes for newly imported Java package .m files
John W. Eaton <jwe@octave.org>
parents:
15746
diff
changeset
|
110 |
21630
b5d9b95d1e1a
Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21178
diff
changeset
|
111 defaults = cellstr (cell (size (prompt))); |
b5d9b95d1e1a
Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21178
diff
changeset
|
112 if (nargin > 3) |
24805
e098b0fb11ab
inputdlg.m: Avoid crash when prompt and defaults sizes differ (bug #53209).
Philip Nienhuis <prnienhuis@user.sf.net>
parents:
23219
diff
changeset
|
113 if (numel (varargin{3}) != numel (prompt)) |
e098b0fb11ab
inputdlg.m: Avoid crash when prompt and defaults sizes differ (bug #53209).
Philip Nienhuis <prnienhuis@user.sf.net>
parents:
23219
diff
changeset
|
114 error ("inputdlg: number of DEFAULT items must match number of PROMPT items"); |
e098b0fb11ab
inputdlg.m: Avoid crash when prompt and defaults sizes differ (bug #53209).
Philip Nienhuis <prnienhuis@user.sf.net>
parents:
23219
diff
changeset
|
115 endif |
21630
b5d9b95d1e1a
Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21178
diff
changeset
|
116 defaults = varargin{3}; |
b5d9b95d1e1a
Removing Java dialog boxes.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
21178
diff
changeset
|
117 endif |
22636
c44d57c0a925
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
22530
diff
changeset
|
118 |
22530
db762b9b9b72
inputdlg.m: proper rowcols handling and accept options parameter (bug #49143)
Avinoam Kalma <a.kalma@gmail.com>
parents:
22323
diff
changeset
|
119 if (nargin > 4) |
db762b9b9b72
inputdlg.m: proper rowcols handling and accept options parameter (bug #49143)
Avinoam Kalma <a.kalma@gmail.com>
parents:
22323
diff
changeset
|
120 warning ("inputdlg: 5th 'options' argument ignored"); |
db762b9b9b72
inputdlg.m: proper rowcols handling and accept options parameter (bug #49143)
Avinoam Kalma <a.kalma@gmail.com>
parents:
22323
diff
changeset
|
121 endif |
22636
c44d57c0a925
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
22530
diff
changeset
|
122 |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
123 ## specification of text field sizes as in Matlab |
15772
0f1a143e5002
Overhaul scripts/java directory to conform to Octave core.
Rik <rik@octave.org>
parents:
15750
diff
changeset
|
124 ## Matlab requires a matrix for linespec, not a cell array... |
15748
54e8c2527a9e
style and doc fixes for newly imported Java package .m files
John W. Eaton <jwe@octave.org>
parents:
15746
diff
changeset
|
125 ## rc = [1,10; 2,20; 3,30]; |
54e8c2527a9e
style and doc fixes for newly imported Java package .m files
John W. Eaton <jwe@octave.org>
parents:
15746
diff
changeset
|
126 ## c1 c2 |
54e8c2527a9e
style and doc fixes for newly imported Java package .m files
John W. Eaton <jwe@octave.org>
parents:
15746
diff
changeset
|
127 ## r1 1 10 first text field is 1x10 |
54e8c2527a9e
style and doc fixes for newly imported Java package .m files
John W. Eaton <jwe@octave.org>
parents:
15746
diff
changeset
|
128 ## r2 2 20 second text field is 2x20 |
54e8c2527a9e
style and doc fixes for newly imported Java package .m files
John W. Eaton <jwe@octave.org>
parents:
15746
diff
changeset
|
129 ## r3 3 30 third text field is 3x30 |
21171
2935d56203a4
Fix regressions caused by ismatrix definition change (partial fix bug #47036).
Rik <rik@octave.org>
parents:
20173
diff
changeset
|
130 if (! isnumeric (linespec)) |
21637
59ebef9680ef
More cleanup associated with removing Java dialog boxes (cset b5d9b95d1e1a).
Rik <rik@octave.org>
parents:
21630
diff
changeset
|
131 error ("inputdlg: ROWSCOLS must be numeric"); |
21171
2935d56203a4
Fix regressions caused by ismatrix definition change (partial fix bug #47036).
Rik <rik@octave.org>
parents:
20173
diff
changeset
|
132 endif |
2935d56203a4
Fix regressions caused by ismatrix definition change (partial fix bug #47036).
Rik <rik@octave.org>
parents:
20173
diff
changeset
|
133 |
15772
0f1a143e5002
Overhaul scripts/java directory to conform to Octave core.
Rik <rik@octave.org>
parents:
15750
diff
changeset
|
134 if (isscalar (linespec)) |
0f1a143e5002
Overhaul scripts/java directory to conform to Octave core.
Rik <rik@octave.org>
parents:
15750
diff
changeset
|
135 ## only scalar value in lineTo, copy from linespec and add defaults |
19952
028b2302f940
inputdlg: allow input prompts of varied size, return answer as column vector (Bug 44552)
John Donoghue <john.donoghue@ieee.org>
parents:
19848
diff
changeset
|
136 rowscols = zeros (numel (prompt), 2); |
15748
54e8c2527a9e
style and doc fixes for newly imported Java package .m files
John W. Eaton <jwe@octave.org>
parents:
15746
diff
changeset
|
137 ## cols |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
138 rowscols(:,2) = 25; |
15772
0f1a143e5002
Overhaul scripts/java directory to conform to Octave core.
Rik <rik@octave.org>
parents:
15750
diff
changeset
|
139 rowscols(:,1) = linespec; |
0f1a143e5002
Overhaul scripts/java directory to conform to Octave core.
Rik <rik@octave.org>
parents:
15750
diff
changeset
|
140 elseif (ismatrix (linespec)) |
0f1a143e5002
Overhaul scripts/java directory to conform to Octave core.
Rik <rik@octave.org>
parents:
15750
diff
changeset
|
141 if (rows (linespec) == columns (prompt) && columns (linespec) == 2) |
0f1a143e5002
Overhaul scripts/java directory to conform to Octave core.
Rik <rik@octave.org>
parents:
15750
diff
changeset
|
142 ## (rows x columns) match, copy array linespec |
0f1a143e5002
Overhaul scripts/java directory to conform to Octave core.
Rik <rik@octave.org>
parents:
15750
diff
changeset
|
143 rowscols = linespec; |
22530
db762b9b9b72
inputdlg.m: proper rowcols handling and accept options parameter (bug #49143)
Avinoam Kalma <a.kalma@gmail.com>
parents:
22323
diff
changeset
|
144 elseif (isvector (linespec)) |
db762b9b9b72
inputdlg.m: proper rowcols handling and accept options parameter (bug #49143)
Avinoam Kalma <a.kalma@gmail.com>
parents:
22323
diff
changeset
|
145 if (numel (linespec) == numel (prompt)) |
db762b9b9b72
inputdlg.m: proper rowcols handling and accept options parameter (bug #49143)
Avinoam Kalma <a.kalma@gmail.com>
parents:
22323
diff
changeset
|
146 ## only one column in lineTo, copy from vector linespec and add defaults |
db762b9b9b72
inputdlg.m: proper rowcols handling and accept options parameter (bug #49143)
Avinoam Kalma <a.kalma@gmail.com>
parents:
22323
diff
changeset
|
147 rowscols = zeros (numel (prompt), 2); |
27956
2310164737b3
fix many spelling errors (bug #57613)
John W. Eaton <jwe@octave.org>
parents:
26577
diff
changeset
|
148 ## rows from column vector linespec, columns are set to default |
22530
db762b9b9b72
inputdlg.m: proper rowcols handling and accept options parameter (bug #49143)
Avinoam Kalma <a.kalma@gmail.com>
parents:
22323
diff
changeset
|
149 rowscols(:,2) = 25; |
db762b9b9b72
inputdlg.m: proper rowcols handling and accept options parameter (bug #49143)
Avinoam Kalma <a.kalma@gmail.com>
parents:
22323
diff
changeset
|
150 rowscols(:,1) = linespec(:); |
db762b9b9b72
inputdlg.m: proper rowcols handling and accept options parameter (bug #49143)
Avinoam Kalma <a.kalma@gmail.com>
parents:
22323
diff
changeset
|
151 else |
db762b9b9b72
inputdlg.m: proper rowcols handling and accept options parameter (bug #49143)
Avinoam Kalma <a.kalma@gmail.com>
parents:
22323
diff
changeset
|
152 error ("inputdlg: ROWSCOLS vector does not match size of PROMPT"); |
db762b9b9b72
inputdlg.m: proper rowcols handling and accept options parameter (bug #49143)
Avinoam Kalma <a.kalma@gmail.com>
parents:
22323
diff
changeset
|
153 endif |
15772
0f1a143e5002
Overhaul scripts/java directory to conform to Octave core.
Rik <rik@octave.org>
parents:
15750
diff
changeset
|
154 else |
21637
59ebef9680ef
More cleanup associated with removing Java dialog boxes (cset b5d9b95d1e1a).
Rik <rik@octave.org>
parents:
21630
diff
changeset
|
155 error ("inputdlg: ROWSCOLS matrix does not match size of PROMPT"); |
15748
54e8c2527a9e
style and doc fixes for newly imported Java package .m files
John W. Eaton <jwe@octave.org>
parents:
15746
diff
changeset
|
156 endif |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
157 else |
15748
54e8c2527a9e
style and doc fixes for newly imported Java package .m files
John W. Eaton <jwe@octave.org>
parents:
15746
diff
changeset
|
158 ## dunno |
21637
59ebef9680ef
More cleanup associated with removing Java dialog boxes (cset b5d9b95d1e1a).
Rik <rik@octave.org>
parents:
21630
diff
changeset
|
159 error ("inputdlg: unknown form of ROWSCOLS argument"); |
15748
54e8c2527a9e
style and doc fixes for newly imported Java package .m files
John W. Eaton <jwe@octave.org>
parents:
15746
diff
changeset
|
160 endif |
16551
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16512
diff
changeset
|
161 rowscols = ceil (rowscols); |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
162 |
15748
54e8c2527a9e
style and doc fixes for newly imported Java package .m files
John W. Eaton <jwe@octave.org>
parents:
15746
diff
changeset
|
163 ## convert numeric values in defaults cell array to strings |
54e8c2527a9e
style and doc fixes for newly imported Java package .m files
John W. Eaton <jwe@octave.org>
parents:
15746
diff
changeset
|
164 defs = cellfun (@num2str, defaults, "UniformOutput", false); |
15625
acf0addfc610
include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
165 |
27263
99aa1bcb8848
rename octave_link and octave_link_events classes, move inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26577
diff
changeset
|
166 if (__event_manager_enabled__ ()) |
99aa1bcb8848
rename octave_link and octave_link_events classes, move inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26577
diff
changeset
|
167 cstr = __event_manager_input_dialog__ (prompt, title, rowscols, defs); |
16551
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16512
diff
changeset
|
168 else |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16512
diff
changeset
|
169 error ("inputdlg is not available in this version of Octave"); |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16505
diff
changeset
|
170 endif |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16505
diff
changeset
|
171 |
15748
54e8c2527a9e
style and doc fixes for newly imported Java package .m files
John W. Eaton <jwe@octave.org>
parents:
15746
diff
changeset
|
172 endfunction |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16505
diff
changeset
|
173 |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16505
diff
changeset
|
174 |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16505
diff
changeset
|
175 %!demo |
16933
e39f00a32dc7
maint: Use parentheses around condition for switch(),while(),if() statements.
Rik <rik@octave.org>
parents:
16551
diff
changeset
|
176 %! disp ('- test inputdlg with prompt and caption only.'); |
21637
59ebef9680ef
More cleanup associated with removing Java dialog boxes (cset b5d9b95d1e1a).
Rik <rik@octave.org>
parents:
21630
diff
changeset
|
177 %! prompt = {'Width', 'Height', 'Depth'}; |
16933
e39f00a32dc7
maint: Use parentheses around condition for switch(),while(),if() statements.
Rik <rik@octave.org>
parents:
16551
diff
changeset
|
178 %! dims = inputdlg (prompt, 'Enter Box Dimensions'); |
e39f00a32dc7
maint: Use parentheses around condition for switch(),while(),if() statements.
Rik <rik@octave.org>
parents:
16551
diff
changeset
|
179 %! if (isempty (dims)) |
e39f00a32dc7
maint: Use parentheses around condition for switch(),while(),if() statements.
Rik <rik@octave.org>
parents:
16551
diff
changeset
|
180 %! helpdlg ('Canceled by user', 'Information'); |
e39f00a32dc7
maint: Use parentheses around condition for switch(),while(),if() statements.
Rik <rik@octave.org>
parents:
16551
diff
changeset
|
181 %! else |
e39f00a32dc7
maint: Use parentheses around condition for switch(),while(),if() statements.
Rik <rik@octave.org>
parents:
16551
diff
changeset
|
182 %! volume = str2num (dims{1}) * str2num (dims{2}) * str2num (dims{3}); |
e39f00a32dc7
maint: Use parentheses around condition for switch(),while(),if() statements.
Rik <rik@octave.org>
parents:
16551
diff
changeset
|
183 %! surface = 2 * (str2num (dims{1}) * str2num (dims{2}) + ... |
e39f00a32dc7
maint: Use parentheses around condition for switch(),while(),if() statements.
Rik <rik@octave.org>
parents:
16551
diff
changeset
|
184 %! str2num (dims{2}) * str2num (dims{3}) + ... |
e39f00a32dc7
maint: Use parentheses around condition for switch(),while(),if() statements.
Rik <rik@octave.org>
parents:
16551
diff
changeset
|
185 %! str2num (dims{1}) * str2num (dims{3})); |
21637
59ebef9680ef
More cleanup associated with removing Java dialog boxes (cset b5d9b95d1e1a).
Rik <rik@octave.org>
parents:
21630
diff
changeset
|
186 %! helpdlg (sprintf ('Results:\nVolume = %.3f\nSurface = %.3f', ... |
59ebef9680ef
More cleanup associated with removing Java dialog boxes (cset b5d9b95d1e1a).
Rik <rik@octave.org>
parents:
21630
diff
changeset
|
187 %! volume, surface), 'Box Dimensions'); |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21637
diff
changeset
|
188 %! endif |
16933
e39f00a32dc7
maint: Use parentheses around condition for switch(),while(),if() statements.
Rik <rik@octave.org>
parents:
16551
diff
changeset
|
189 |
e39f00a32dc7
maint: Use parentheses around condition for switch(),while(),if() statements.
Rik <rik@octave.org>
parents:
16551
diff
changeset
|
190 %!demo |
e39f00a32dc7
maint: Use parentheses around condition for switch(),while(),if() statements.
Rik <rik@octave.org>
parents:
16551
diff
changeset
|
191 %! disp ('- test inputdlg with prescribed scalar (2 lines per text field) and defaults.'); |
21637
59ebef9680ef
More cleanup associated with removing Java dialog boxes (cset b5d9b95d1e1a).
Rik <rik@octave.org>
parents:
21630
diff
changeset
|
192 %! prompt = {'Width', 'Height', 'Depth'}; |
59ebef9680ef
More cleanup associated with removing Java dialog boxes (cset b5d9b95d1e1a).
Rik <rik@octave.org>
parents:
21630
diff
changeset
|
193 %! default = {'1.1', '2.2', '3.3'}; |
16933
e39f00a32dc7
maint: Use parentheses around condition for switch(),while(),if() statements.
Rik <rik@octave.org>
parents:
16551
diff
changeset
|
194 %! rc = 2; |
21637
59ebef9680ef
More cleanup associated with removing Java dialog boxes (cset b5d9b95d1e1a).
Rik <rik@octave.org>
parents:
21630
diff
changeset
|
195 %! dims = inputdlg (prompt, 'Enter Box Dimensions', rc, default); |
16933
e39f00a32dc7
maint: Use parentheses around condition for switch(),while(),if() statements.
Rik <rik@octave.org>
parents:
16551
diff
changeset
|
196 %! if (isempty (dims)) |
e39f00a32dc7
maint: Use parentheses around condition for switch(),while(),if() statements.
Rik <rik@octave.org>
parents:
16551
diff
changeset
|
197 %! helpdlg ('Canceled by user', 'Information'); |
e39f00a32dc7
maint: Use parentheses around condition for switch(),while(),if() statements.
Rik <rik@octave.org>
parents:
16551
diff
changeset
|
198 %! else |
e39f00a32dc7
maint: Use parentheses around condition for switch(),while(),if() statements.
Rik <rik@octave.org>
parents:
16551
diff
changeset
|
199 %! volume = str2num (dims{1}) * str2num (dims{2}) * str2num (dims{3}); |
e39f00a32dc7
maint: Use parentheses around condition for switch(),while(),if() statements.
Rik <rik@octave.org>
parents:
16551
diff
changeset
|
200 %! surface = 2 * (str2num (dims{1}) * str2num (dims{2}) + ... |
e39f00a32dc7
maint: Use parentheses around condition for switch(),while(),if() statements.
Rik <rik@octave.org>
parents:
16551
diff
changeset
|
201 %! str2num (dims{2}) * str2num (dims{3}) + ... |
e39f00a32dc7
maint: Use parentheses around condition for switch(),while(),if() statements.
Rik <rik@octave.org>
parents:
16551
diff
changeset
|
202 %! str2num (dims{1}) * str2num (dims{3})); |
21637
59ebef9680ef
More cleanup associated with removing Java dialog boxes (cset b5d9b95d1e1a).
Rik <rik@octave.org>
parents:
21630
diff
changeset
|
203 %! helpdlg (sprintf ('Results:\nVolume = %.3f\nSurface = %.3f', ... |
59ebef9680ef
More cleanup associated with removing Java dialog boxes (cset b5d9b95d1e1a).
Rik <rik@octave.org>
parents:
21630
diff
changeset
|
204 %! volume, surface), 'Box Dimensions'); |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21637
diff
changeset
|
205 %! endif |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16505
diff
changeset
|
206 |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16505
diff
changeset
|
207 %!demo |
16933
e39f00a32dc7
maint: Use parentheses around condition for switch(),while(),if() statements.
Rik <rik@octave.org>
parents:
16551
diff
changeset
|
208 %! disp ('- test inputdlg with prescribed vector [1,2,3] for # of lines per text field and defaults.'); |
21637
59ebef9680ef
More cleanup associated with removing Java dialog boxes (cset b5d9b95d1e1a).
Rik <rik@octave.org>
parents:
21630
diff
changeset
|
209 %! prompt = {'Width', 'Height', 'Depth'}; |
16933
e39f00a32dc7
maint: Use parentheses around condition for switch(),while(),if() statements.
Rik <rik@octave.org>
parents:
16551
diff
changeset
|
210 %! default = {'1.10', '2.10', '3.10'}; |
22737
7abc25e6206a
maint: Clean up code base to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
22636
diff
changeset
|
211 %! rc = [1,2,3]; # NOTE: must be an array |
21637
59ebef9680ef
More cleanup associated with removing Java dialog boxes (cset b5d9b95d1e1a).
Rik <rik@octave.org>
parents:
21630
diff
changeset
|
212 %! dims = inputdlg (prompt, 'Enter Box Dimensions', rc, default); |
16933
e39f00a32dc7
maint: Use parentheses around condition for switch(),while(),if() statements.
Rik <rik@octave.org>
parents:
16551
diff
changeset
|
213 %! if (isempty (dims)) |
e39f00a32dc7
maint: Use parentheses around condition for switch(),while(),if() statements.
Rik <rik@octave.org>
parents:
16551
diff
changeset
|
214 %! helpdlg ('Canceled by user', 'Information'); |
e39f00a32dc7
maint: Use parentheses around condition for switch(),while(),if() statements.
Rik <rik@octave.org>
parents:
16551
diff
changeset
|
215 %! else |
e39f00a32dc7
maint: Use parentheses around condition for switch(),while(),if() statements.
Rik <rik@octave.org>
parents:
16551
diff
changeset
|
216 %! volume = str2num (dims{1}) * str2num (dims{2}) * str2num (dims{3}); |
e39f00a32dc7
maint: Use parentheses around condition for switch(),while(),if() statements.
Rik <rik@octave.org>
parents:
16551
diff
changeset
|
217 %! surface = 2 * (str2num (dims{1}) * str2num (dims{2}) + ... |
e39f00a32dc7
maint: Use parentheses around condition for switch(),while(),if() statements.
Rik <rik@octave.org>
parents:
16551
diff
changeset
|
218 %! str2num (dims{2}) * str2num (dims{3}) + ... |
e39f00a32dc7
maint: Use parentheses around condition for switch(),while(),if() statements.
Rik <rik@octave.org>
parents:
16551
diff
changeset
|
219 %! str2num (dims{1}) * str2num (dims{3})); |
21637
59ebef9680ef
More cleanup associated with removing Java dialog boxes (cset b5d9b95d1e1a).
Rik <rik@octave.org>
parents:
21630
diff
changeset
|
220 %! helpdlg (sprintf ('Results:\nVolume = %.3f\nSurface = %.3f', ... |
59ebef9680ef
More cleanup associated with removing Java dialog boxes (cset b5d9b95d1e1a).
Rik <rik@octave.org>
parents:
21630
diff
changeset
|
221 %! volume, surface), 'Box Dimensions'); |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21637
diff
changeset
|
222 %! endif |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16505
diff
changeset
|
223 |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16505
diff
changeset
|
224 %!demo |
16933
e39f00a32dc7
maint: Use parentheses around condition for switch(),while(),if() statements.
Rik <rik@octave.org>
parents:
16551
diff
changeset
|
225 %! disp ('- test inputdlg with prescribed row by column sizes and defaults.'); |
21637
59ebef9680ef
More cleanup associated with removing Java dialog boxes (cset b5d9b95d1e1a).
Rik <rik@octave.org>
parents:
21630
diff
changeset
|
226 %! prompt = {'Width', 'Height', 'Depth'}; |
16933
e39f00a32dc7
maint: Use parentheses around condition for switch(),while(),if() statements.
Rik <rik@octave.org>
parents:
16551
diff
changeset
|
227 %! default = {'1.10', '2.20', '3.30'}; |
22737
7abc25e6206a
maint: Clean up code base to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
22636
diff
changeset
|
228 %! rc = [1,10; 2,20; 3,30]; # NOTE: must be an array |
21637
59ebef9680ef
More cleanup associated with removing Java dialog boxes (cset b5d9b95d1e1a).
Rik <rik@octave.org>
parents:
21630
diff
changeset
|
229 %! dims = inputdlg (prompt, 'Enter Box Dimensions', rc, default); |
16933
e39f00a32dc7
maint: Use parentheses around condition for switch(),while(),if() statements.
Rik <rik@octave.org>
parents:
16551
diff
changeset
|
230 %! if (isempty (dims)) |
e39f00a32dc7
maint: Use parentheses around condition for switch(),while(),if() statements.
Rik <rik@octave.org>
parents:
16551
diff
changeset
|
231 %! helpdlg ('Canceled by user', 'Information'); |
e39f00a32dc7
maint: Use parentheses around condition for switch(),while(),if() statements.
Rik <rik@octave.org>
parents:
16551
diff
changeset
|
232 %! else |
e39f00a32dc7
maint: Use parentheses around condition for switch(),while(),if() statements.
Rik <rik@octave.org>
parents:
16551
diff
changeset
|
233 %! volume = str2num (dims{1}) * str2num (dims{2}) * str2num (dims{3}); |
e39f00a32dc7
maint: Use parentheses around condition for switch(),while(),if() statements.
Rik <rik@octave.org>
parents:
16551
diff
changeset
|
234 %! surface = 2 * (str2num (dims{1}) * str2num (dims{2}) + ... |
e39f00a32dc7
maint: Use parentheses around condition for switch(),while(),if() statements.
Rik <rik@octave.org>
parents:
16551
diff
changeset
|
235 %! str2num (dims{2}) * str2num (dims{3}) + ... |
e39f00a32dc7
maint: Use parentheses around condition for switch(),while(),if() statements.
Rik <rik@octave.org>
parents:
16551
diff
changeset
|
236 %! str2num (dims{1}) * str2num (dims{3})); |
21637
59ebef9680ef
More cleanup associated with removing Java dialog boxes (cset b5d9b95d1e1a).
Rik <rik@octave.org>
parents:
21630
diff
changeset
|
237 %! helpdlg (sprintf ('Results:\nVolume = %.3f\nSurface = %.3f', ... |
59ebef9680ef
More cleanup associated with removing Java dialog boxes (cset b5d9b95d1e1a).
Rik <rik@octave.org>
parents:
21630
diff
changeset
|
238 %! volume, surface), 'Box Dimensions'); |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21637
diff
changeset
|
239 %! endif |
16933
e39f00a32dc7
maint: Use parentheses around condition for switch(),while(),if() statements.
Rik <rik@octave.org>
parents:
16551
diff
changeset
|
240 |
22530
db762b9b9b72
inputdlg.m: proper rowcols handling and accept options parameter (bug #49143)
Avinoam Kalma <a.kalma@gmail.com>
parents:
22323
diff
changeset
|
241 %!demo |
db762b9b9b72
inputdlg.m: proper rowcols handling and accept options parameter (bug #49143)
Avinoam Kalma <a.kalma@gmail.com>
parents:
22323
diff
changeset
|
242 %! disp ('- test inputdlg with vector for a single item.'); |
db762b9b9b72
inputdlg.m: proper rowcols handling and accept options parameter (bug #49143)
Avinoam Kalma <a.kalma@gmail.com>
parents:
22323
diff
changeset
|
243 %! prompt = {'enter x value'}; |
db762b9b9b72
inputdlg.m: proper rowcols handling and accept options parameter (bug #49143)
Avinoam Kalma <a.kalma@gmail.com>
parents:
22323
diff
changeset
|
244 %! default = {1}; |
26035
0a39db17170c
doc: Clean up docstrings for XXXdlg.m functions
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
245 %! answer = inputdlg (prompt, 'Enter value', [1 10], default); |
22530
db762b9b9b72
inputdlg.m: proper rowcols handling and accept options parameter (bug #49143)
Avinoam Kalma <a.kalma@gmail.com>
parents:
22323
diff
changeset
|
246 %! if (isempty (answer)) |
db762b9b9b72
inputdlg.m: proper rowcols handling and accept options parameter (bug #49143)
Avinoam Kalma <a.kalma@gmail.com>
parents:
22323
diff
changeset
|
247 %! helpdlg ('Canceled by user', 'Information'); |
db762b9b9b72
inputdlg.m: proper rowcols handling and accept options parameter (bug #49143)
Avinoam Kalma <a.kalma@gmail.com>
parents:
22323
diff
changeset
|
248 %! else |
26035
0a39db17170c
doc: Clean up docstrings for XXXdlg.m functions
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
249 %! helpdlg (sprintf ('answer = %d', str2num (answer{1})), 'answer'); |
22530
db762b9b9b72
inputdlg.m: proper rowcols handling and accept options parameter (bug #49143)
Avinoam Kalma <a.kalma@gmail.com>
parents:
22323
diff
changeset
|
250 %! endif |
db762b9b9b72
inputdlg.m: proper rowcols handling and accept options parameter (bug #49143)
Avinoam Kalma <a.kalma@gmail.com>
parents:
22323
diff
changeset
|
251 |
db762b9b9b72
inputdlg.m: proper rowcols handling and accept options parameter (bug #49143)
Avinoam Kalma <a.kalma@gmail.com>
parents:
22323
diff
changeset
|
252 %!error inputdlg (1, 2, 3, 4, 5, 6) |
21637
59ebef9680ef
More cleanup associated with removing Java dialog boxes (cset b5d9b95d1e1a).
Rik <rik@octave.org>
parents:
21630
diff
changeset
|
253 %!error <PROMPT must be a character string> inputdlg (1) |
59ebef9680ef
More cleanup associated with removing Java dialog boxes (cset b5d9b95d1e1a).
Rik <rik@octave.org>
parents:
21630
diff
changeset
|
254 %!error <TITLE must be a character string> inputdlg ("msg", 1) |
59ebef9680ef
More cleanup associated with removing Java dialog boxes (cset b5d9b95d1e1a).
Rik <rik@octave.org>
parents:
21630
diff
changeset
|
255 %!error <ROWSCOLS must be numeric> inputdlg ("msg", "title", "1") |
59ebef9680ef
More cleanup associated with removing Java dialog boxes (cset b5d9b95d1e1a).
Rik <rik@octave.org>
parents:
21630
diff
changeset
|
256 %!error <ROWSCOLS vector does not match size> |
59ebef9680ef
More cleanup associated with removing Java dialog boxes (cset b5d9b95d1e1a).
Rik <rik@octave.org>
parents:
21630
diff
changeset
|
257 %! inputdlg ({"a1", "a2"}, "title", [1, 2, 3]); |