Mercurial > octave
annotate scripts/gui/dialog.m @ 33623:4517f929c59d bytecode-interpreter tip
maint: Merge default to bytecode-interpreter
author | Arun Giridhar <arungiridhar@gmail.com> |
---|---|
date | Fri, 24 May 2024 16:22:41 -0400 |
parents | 2e484f9f1f18 |
children |
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 ## |
32632
2e484f9f1f18
maint: update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
31706
diff
changeset
|
3 ## Copyright (C) 2016-2024 The Octave Project Developers |
27918
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
26376
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/>. |
21825
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
7 ## |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
8 ## This file is part of Octave. |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.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 |
21825
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
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:
22299
diff
changeset
|
13 ## (at your option) any later version. |
21825
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
14 ## |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
15 ## Octave is distributed in the hope that it will be useful, but |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22299
diff
changeset
|
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22299
diff
changeset
|
18 ## GNU General Public License for more details. |
21825
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
19 ## |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
20 ## You should have received a copy of the GNU General Public License |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
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 ######################################################################## |
21825
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
25 |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
26 ## -*- texinfo -*- |
22787 | 27 ## @deftypefn {} {@var{h} =} dialog () |
28 ## @deftypefnx {} {@var{h} =} dialog ("@var{property}", @var{value}, @dots{}) | |
21825
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
29 ## |
22787 | 30 ## Create an empty modal dialog window to which other uicontrols can be added. |
21825
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
31 ## |
22299
9fc91bb2aec3
doc: grammarcheck documentation for 4.2 release.
Rik <rik@octave.org>
parents:
21937
diff
changeset
|
32 ## The dialog box is a figure object with properties as recommended for a |
9fc91bb2aec3
doc: grammarcheck documentation for 4.2 release.
Rik <rik@octave.org>
parents:
21937
diff
changeset
|
33 ## dialog box. |
21825
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
34 ## |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
35 ## The default properties differing from a figure are: |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
36 ## |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
37 ## @table @asis |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
38 ## @item buttondownfcn |
22787 | 39 ## @code{if isempty (allchild(gcbf)), close (gcbf), endif} |
21825
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
40 ## |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
41 ## @item colormap |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
42 ## [] |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
43 ## |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
44 ## @item color |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
45 ## defaultuicontrolbackgroundcolor |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
46 ## |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
47 ## @item dockcontrols |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
48 ## off |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
49 ## |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
50 ## @item handlevisibility |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
51 ## callback |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
52 ## |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
53 ## @item integerhandle |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
54 ## off |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
55 ## |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
56 ## @item inverthardcopy |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
57 ## off |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
58 ## |
21937
55f7de37b618
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
21825
diff
changeset
|
59 ## @item menubar |
21825
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
60 ## none |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
61 ## |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
62 ## @item numbertitle |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
63 ## off |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
64 ## |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
65 ## @item paperpositionmode |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
66 ## auto |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
67 ## |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
68 ## @item resize |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
69 ## off |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
70 ## |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
71 ## @item windowstyle |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
72 ## modal |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
73 ## |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
74 ## @end table |
21937
55f7de37b618
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
21825
diff
changeset
|
75 ## |
21825
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
76 ## |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
77 ## Multiple property-value pairs may be specified for the dialog object, but |
28733
9342688e86b4
Updated property references for text and graphics functions (bug #50247)
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
78 ## they must appear in pairs. The full list of properties is documented at |
9342688e86b4
Updated property references for text and graphics functions (bug #50247)
Nicholas R. Jankowski <jankowskin@asme.org>
parents:
27978
diff
changeset
|
79 ## @ref{Figure Properties}. |
21825
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
80 ## |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
81 ## The return value @var{h} is a graphics handle to the created figure. |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
82 ## |
22787 | 83 ## Example: |
21825
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
84 ## |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
85 ## @example |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
86 ## @group |
22787 | 87 ## ## create an empty dialog window titled "Dialog Example" |
21825
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
88 ## h = dialog ("name", "Dialog Example"); |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
89 ## |
22787 | 90 ## ## create a button (default style) |
91 ## b = uicontrol (h, "string", "OK", | |
92 ## "position", [10 10 150 40], | |
93 ## "callback", "delete (gcf)"); | |
21825
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
94 ## |
22787 | 95 ## ## wait for dialog to resume or close |
21825
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
96 ## uiwait (h); |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
97 ## @end group |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
98 ## @end example |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
99 ## |
22787 | 100 ## @seealso{errordlg, msgbox, questdlg, warndlg, figure, uiwait} |
21825
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
101 ## @end deftypefn |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
102 |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
103 function h = dialog (varargin) |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
104 |
22787 | 105 h = figure ( ... |
106 "buttondownfcn", "if isempty (allchild (gcbf)), close (gcbf), endif", | |
107 "color", get (0,"defaultuicontrolbackgroundcolor"), | |
108 "colormap", [], | |
109 "dockcontrols", "off", | |
110 "handlevisibility", "callback", | |
111 "integerhandle", "off", | |
112 "inverthardcopy", "off", | |
113 "menubar", "none", | |
114 "numbertitle", "off", | |
115 "paperpositionmode", "auto", | |
116 "resize", "off", | |
117 "toolbar", "none", | |
118 "windowstyle", "modal", | |
119 varargin{:}); | |
21937
55f7de37b618
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
21825
diff
changeset
|
120 |
21825
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
121 endfunction |
f1f17f13b3b9
Add dialog function (Bug #48136)
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
122 |
22787 | 123 ## No BIST tests. This function just dispatches to figure(). |
124 %!assert (1) |