File: I_002fO-Dialogs.html

package info (click to toggle)
octave 6.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 124,192 kB
  • sloc: cpp: 322,665; ansic: 68,088; fortran: 20,980; objc: 8,121; sh: 7,719; yacc: 4,266; lex: 4,123; perl: 1,530; java: 1,366; awk: 1,257; makefile: 424; xml: 147
file content (695 lines) | stat: -rw-r--r-- 31,580 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by GNU Texinfo 6.7, http://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>I/O Dialogs (GNU Octave (version 6.2.0))</title>

<meta name="description" content="I/O Dialogs (GNU Octave (version 6.2.0))">
<meta name="keywords" content="I/O Dialogs (GNU Octave (version 6.2.0))">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<link href="index.html" rel="start" title="Top">
<link href="Concept-Index.html" rel="index" title="Concept Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="GUI-Development.html" rel="up" title="GUI Development">
<link href="Progress-Bar.html" rel="next" title="Progress Bar">
<link href="GUI-Development.html" rel="prev" title="GUI Development">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
<link rel="stylesheet" type="text/css" href="octave.css">


</head>

<body lang="en">
<span id="I_002fO-Dialogs"></span><div class="header">
<p>
Next: <a href="Progress-Bar.html" accesskey="n" rel="next">Progress Bar</a>, Up: <a href="GUI-Development.html" accesskey="u" rel="up">GUI Development</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<span id="I_002fO-Dialogs-1"></span><h3 class="section">35.1 I/O Dialogs</h3>

<p>Simple dialog menus are available for choosing directories or files.  They
return a string variable which can then be used with any command requiring
a filename.
</p>
<span id="index-dialog_002c-displaying-a-dialog-for-selecting-directories"></span>
<span id="XREFuigetdir"></span><dl>
<dt id="index-uigetdir">: <em><var>dirname</var> =</em> <strong>uigetdir</strong> <em>()</em></dt>
<dt id="index-uigetdir-1">: <em><var>dirname</var> =</em> <strong>uigetdir</strong> <em>(<var>init_path</var>)</em></dt>
<dt id="index-uigetdir-2">: <em><var>dirname</var> =</em> <strong>uigetdir</strong> <em>(<var>init_path</var>, <var>dialog_name</var>)</em></dt>
<dd><p>Open a GUI dialog for selecting a directory.
</p>
<p>If <var>init_path</var> is not given the current working directory is used.
</p>
<p><var>dialog_name</var> may be used to customize the dialog title.
</p>
<p>The output <var>dirname</var> is a character string with the name of the selected
directory.  However, if the &lsquo;<samp>Cancel</samp>&rsquo; button is clicked the output is of
type double with the value <code>0</code>.
</p>
<p><strong>See also:</strong> <a href="#XREFuigetfile">uigetfile</a>, <a href="#XREFuiputfile">uiputfile</a>.
</p></dd></dl>


<span id="index-dialog_002c-displaying-a-dialog-for-selecting-files"></span>
<span id="XREFuigetfile"></span><dl>
<dt id="index-uigetfile">: <em>[<var>fname</var>, <var>fpath</var>, <var>fltidx</var>] =</em> <strong>uigetfile</strong> <em>()</em></dt>
<dt id="index-uigetfile-1">: <em>[&hellip;] =</em> <strong>uigetfile</strong> <em>(<var>flt</var>)</em></dt>
<dt id="index-uigetfile-2">: <em>[&hellip;] =</em> <strong>uigetfile</strong> <em>(<var>flt</var>, <var>dialog_name</var>)</em></dt>
<dt id="index-uigetfile-3">: <em>[&hellip;] =</em> <strong>uigetfile</strong> <em>(<var>flt</var>, <var>dialog_name</var>, <var>default_file</var>)</em></dt>
<dt id="index-uigetfile-4">: <em>[&hellip;] =</em> <strong>uigetfile</strong> <em>(&hellip;, &quot;Position&quot;, [<var>px</var> <var>py</var>])</em></dt>
<dt id="index-uigetfile-5">: <em>[&hellip;] =</em> <strong>uigetfile</strong> <em>(&hellip;, &quot;MultiSelect&quot;, <var>mode</var>)</em></dt>
<dd>
<p>Open a GUI dialog for selecting a file and return the filename <var>fname</var>,
the path to this file <var>fpath</var>, and the filter index <var>fltidx</var>.
</p>
<p><var>flt</var> contains a (list of) file filter string(s) in one of the following
formats:
</p>
<dl compact="compact">
<dt><code>&quot;/path/to/filename.ext&quot;</code></dt>
<dd><p>If a filename is given then the file extension is extracted and used as
filter.  In addition, the path is selected as current path in the dialog and
the filename is selected as default file.
Example: <code>uigetfile (&quot;myfun.m&quot;)</code>
</p>
</dd>
<dt>A single file extension <code>&quot;*.ext&quot;</code></dt>
<dd><p>Example: <code>uigetfile (&quot;*.ext&quot;)</code>
</p>
</dd>
<dt>A 2-column cell array</dt>
<dd><p>containing a file extension in the first column and a brief description in
the second column.
Example: <code>uigetfile ({&quot;*.ext&quot;, &quot;My Description&quot;;&quot;*.xyz&quot;,
&quot;XYZ-Format&quot;})</code>
</p>
<p>The filter string can also contain a semicolon separated list of filter
extensions.
Example: <code>uigetfile ({&quot;*.gif;*.png;*.jpg&quot;, &quot;Supported Picture
Formats&quot;})</code>
</p>
</dd>
<dt>A directory name or path name</dt>
<dd><p>If the folder name of path name contains a trailing file separator, the
contents of that folder will be displayed.  If no trailing file separator
is present the parent directory is listed.  The substring to the right of
the rightmost file separator (if any) will be interpreted as a file or
directory name and if that file or directory exists it will be highlighted.
If the path name or directory name is entirely or partly nonexistent, the
current working directory will be displayed.
No filter will be active.
</p></dd>
</dl>

<p><var>dialog_name</var> can be used to customize the dialog title.
</p>
<p>If <var>default_file</var> is given then it will be selected in the GUI dialog.
If, in addition, a path is given it is also used as current path.
</p>
<p>The screen position of the GUI dialog can be set using the
<code>&quot;Position&quot;</code> key and a 2-element vector containing the pixel
coordinates.  Two or more files can be selected when setting the
<code>&quot;MultiSelect&quot;</code> key to <code>&quot;on&quot;</code>.  In that case <var>fname</var> is a
cell array containing the files.
</p>
<p>The outputs <var>fname</var> and <var>fpath</var> are strings returning the chosen
name and path, respectively.  However, if the &lsquo;<samp>Cancel</samp>&rsquo; button is
clicked the outputs are of type double with a value of <code>0</code>.
<var>fltidx</var> is the index in the list of filter extensions <var>flt</var> that
was selected.
</p>

<p><strong>See also:</strong> <a href="#XREFuiputfile">uiputfile</a>, <a href="#XREFuigetdir">uigetdir</a>.
</p></dd></dl>


<span id="index-dialog_002c-displaying-a-dialog-for-storing-files"></span>
<span id="XREFuiputfile"></span><dl>
<dt id="index-uiputfile">: <em>[<var>fname</var>, <var>fpath</var>, <var>fltidx</var>] =</em> <strong>uiputfile</strong> <em>()</em></dt>
<dt id="index-uiputfile-1">: <em>[<var>fname</var>, <var>fpath</var>, <var>fltidx</var>] =</em> <strong>uiputfile</strong> <em>(<var>flt</var>)</em></dt>
<dt id="index-uiputfile-2">: <em>[<var>fname</var>, <var>fpath</var>, <var>fltidx</var>] =</em> <strong>uiputfile</strong> <em>(<var>flt</var>, <var>dialog_name</var>)</em></dt>
<dt id="index-uiputfile-3">: <em>[<var>fname</var>, <var>fpath</var>, <var>fltidx</var>] =</em> <strong>uiputfile</strong> <em>(<var>flt</var>, <var>dialog_name</var>, <var>default_file</var>)</em></dt>
<dd><p>Open a GUI dialog for selecting a file.
</p>
<p><var>flt</var> contains a (list of) file filter string(s) in one of the following
formats:
</p>
<dl compact="compact">
<dt><code>&quot;/path/to/filename.ext&quot;</code></dt>
<dd><p>If a filename is given the file extension is extracted and used as filter.
In addition the path is selected as current path in the dialog and the
filename is selected as default file.  Example: <code>uiputfile (&quot;myfun.m&quot;)</code>
</p>
</dd>
<dt><code>&quot;*.ext&quot;</code></dt>
<dd><p>A single file extension.
Example: <code>uiputfile (&quot;*.ext&quot;)</code>
</p>
</dd>
<dt><code>{&quot;*.ext&quot;, &quot;My Description&quot;}</code></dt>
<dd><p>A 2-column cell array containing the file extension in the 1st column and
a brief description in the 2nd column.
Example: <code>uiputfile ({&quot;*.ext&quot;,&quot;My Description&quot;;&quot;*.xyz&quot;,
&quot;XYZ-Format&quot;})</code>
</p></dd>
</dl>

<p>The filter string can also contain a semicolon separated list of filter
extensions.
Example: <code>uiputfile ({&quot;*.gif;*.png;*.jpg&quot;,
&quot;Supported Picture Formats&quot;})</code>
</p>
<p><var>dialog_name</var> can be used to customize the dialog title.
If <var>default_file</var> is given it is preselected in the GUI dialog.
If, in addition, a path is given it is also used as current path.
</p>
<p><var>fname</var> and <var>fpath</var> return the chosen name and path, respectively.
<var>fltidx</var> is the index in the list of filter extensions <var>flt</var> that
was selected.
</p>

<p><strong>See also:</strong> <a href="#XREFuigetfile">uigetfile</a>, <a href="#XREFuigetdir">uigetdir</a>.
</p></dd></dl>


<p>Additionally, there are dialog boxes for displaying help messages, warnings, or
errors, and for getting text input from the user.
</p>
<span id="index-dialog_002c-displaying-an-error-dialog"></span>
<span id="XREFerrordlg"></span><dl>
<dt id="index-errordlg">: <em></em> <strong>errordlg</strong> <em>()</em></dt>
<dt id="index-errordlg-1">: <em></em> <strong>errordlg</strong> <em>(<var>msg</var>)</em></dt>
<dt id="index-errordlg-2">: <em></em> <strong>errordlg</strong> <em>(<var>msg</var>, <var>title</var>)</em></dt>
<dt id="index-errordlg-3">: <em></em> <strong>errordlg</strong> <em>(<var>msg</var>, <var>title</var>, <var>opt</var>)</em></dt>
<dt id="index-errordlg-4">: <em><var>h</var> =</em> <strong>errordlg</strong> <em>(&hellip;)</em></dt>
<dd><p>Display an error dialog box with error message <var>msg</var> and caption
<var>title</var>.
</p>
<p>The default error message is <code>&quot;This is the default error string.&quot;</code>
and the default caption is <code>&quot;Error Dialog&quot;</code>.
</p>
<p>The error message may have multiple lines separated by newline characters
(&quot;\n&quot;), or it may be a cellstr array with one element for each line.
</p>
<p>The third optional argument <var>opt</var> controls the behavior of the dialog.
See <code>msgbox</code> for details.
</p>
<p>The return value <var>h</var> is a handle to the figure object used for
building the dialog.
</p>
<p>Examples:
</p>
<div class="example">
<pre class="example">errordlg (&quot;Some fancy error occurred.&quot;);
errordlg (&quot;Some fancy error\nwith two lines.&quot;);
errordlg ({&quot;Some fancy error&quot;, &quot;with two lines.&quot;});
errordlg (&quot;Some fancy error occurred.&quot;, &quot;Fancy caption&quot;);
</pre></div>


<p><strong>See also:</strong> <a href="#XREFhelpdlg">helpdlg</a>, <a href="#XREFwarndlg">warndlg</a>, <a href="#XREFmsgbox">msgbox</a>, <a href="#XREFinputdlg">inputdlg</a>, <a href="#XREFlistdlg">listdlg</a>, <a href="#XREFquestdlg">questdlg</a>.
</p></dd></dl>


<span id="index-dialog_002c-displaying-a-help-dialog"></span>
<span id="XREFhelpdlg"></span><dl>
<dt id="index-helpdlg">: <em></em> <strong>helpdlg</strong> <em>()</em></dt>
<dt id="index-helpdlg-1">: <em></em> <strong>helpdlg</strong> <em>(<var>msg</var>)</em></dt>
<dt id="index-helpdlg-2">: <em></em> <strong>helpdlg</strong> <em>(<var>msg</var>, <var>title</var>)</em></dt>
<dt id="index-helpdlg-3">: <em><var>h</var> =</em> <strong>helpdlg</strong> <em>(&hellip;)</em></dt>
<dd><p>Display a help dialog box with help message <var>msg</var> and caption
<var>title</var>.
</p>
<p>The default help message is <code>&quot;This is the default help string.&quot;</code>
and the default caption is <code>&quot;Help Dialog&quot;</code>.
</p>
<p>The help message may have multiple lines separated by newline characters
(&quot;\n&quot;), or it may be a cellstr array with one element for each line.
</p>
<p>The return value <var>h</var> is a handle to the figure object used for
building the dialog.
</p>
<p>Examples:
</p>
<div class="example">
<pre class="example">helpdlg (&quot;Some helpful text for the user.&quot;);
helpdlg (&quot;Some helpful text\nwith two lines.&quot;);
helpdlg ({&quot;Some helpful text&quot;, &quot;with two lines.&quot;});
helpdlg (&quot;Some helpful text for the user.&quot;, &quot;Fancy caption&quot;);
</pre></div>


<p><strong>See also:</strong> <a href="#XREFerrordlg">errordlg</a>, <a href="#XREFwarndlg">warndlg</a>, <a href="#XREFmsgbox">msgbox</a>, <a href="#XREFinputdlg">inputdlg</a>, <a href="#XREFlistdlg">listdlg</a>, <a href="#XREFquestdlg">questdlg</a>.
</p></dd></dl>


<span id="index-dialog_002c-displaying-an-input-dialog"></span>
<span id="XREFinputdlg"></span><dl>
<dt id="index-inputdlg">: <em><var>cstr</var> =</em> <strong>inputdlg</strong> <em>(<var>prompt</var>)</em></dt>
<dt id="index-inputdlg-1">: <em><var>cstr</var> =</em> <strong>inputdlg</strong> <em>(<var>prompt</var>, <var>title</var>)</em></dt>
<dt id="index-inputdlg-2">: <em><var>cstr</var> =</em> <strong>inputdlg</strong> <em>(<var>prompt</var>, <var>title</var>, <var>rowscols</var>)</em></dt>
<dt id="index-inputdlg-3">: <em><var>cstr</var> =</em> <strong>inputdlg</strong> <em>(<var>prompt</var>, <var>title</var>, <var>rowscols</var>, <var>defaults</var>)</em></dt>
<dt id="index-inputdlg-4">: <em><var>cstr</var> =</em> <strong>inputdlg</strong> <em>(<var>prompt</var>, <var>title</var>, <var>rowscols</var>, <var>defaults</var>, <var>options</var>)</em></dt>
<dd><p>Return user input from a multi-textfield dialog box in a cell array of
strings, or an empty cell array if the dialog is closed by the Cancel
button.
</p>
<p>Inputs:
</p>
<dl compact="compact">
<dt><var>prompt</var></dt>
<dd><p>A cell array with strings labeling each text field.  This input is required.
</p>
</dd>
<dt><var>title</var></dt>
<dd><p>String to use for the caption of the dialog.  The default is
<code>&quot;Input Dialog&quot;</code>.
</p>
</dd>
<dt><var>rowscols</var></dt>
<dd><p>Specifies the size of the text fields and can take three forms:
</p>
<ol>
<li> a scalar value which defines the number of rows used for each text
field.

</li><li> a vector which defines the individual number of rows used for each
text field.

</li><li> a matrix which defines the individual number of rows and columns used
for each text field.  In the matrix each row describes a single text field.
The first column specifies the number of input rows to use and the second
column specifies the text field width.
</li></ol>

</dd>
<dt><var>defaults</var></dt>
<dd><p>A list of default values to place in each text field.  It must be a cell
array of strings with the same size as <var>prompt</var>.
</p>
</dd>
<dt><var>options</var></dt>
<dd><p>Not supported, only for <small>MATLAB</small> compatibility.
</p></dd>
</dl>

<p>Example:
</p>
<div class="example">
<pre class="example">prompt = {&quot;Width&quot;, &quot;Height&quot;, &quot;Depth&quot;};
defaults = {&quot;1.10&quot;, &quot;2.20&quot;, &quot;3.30&quot;};
rowscols = [1,10; 2,20; 3,30];
dims = inputdlg (prompt, &quot;Enter Box Dimensions&quot;, ...
                 rowscols, defaults);
</pre></div>


<p><strong>See also:</strong> <a href="#XREFerrordlg">errordlg</a>, <a href="#XREFhelpdlg">helpdlg</a>, <a href="#XREFlistdlg">listdlg</a>, <a href="#XREFmsgbox">msgbox</a>, <a href="#XREFquestdlg">questdlg</a>, <a href="#XREFwarndlg">warndlg</a>.
</p></dd></dl>


<span id="index-dialog_002c-displaying-a-list-dialog"></span>
<span id="XREFlistdlg"></span><dl>
<dt id="index-listdlg">: <em>[<var>sel</var>, <var>ok</var>] =</em> <strong>listdlg</strong> <em>(<var>key</var>, <var>value</var>, &hellip;)</em></dt>
<dd><p>Return user inputs from a list dialog box in a vector of selection indices
(<var>sel</var>) and a flag indicating how the user closed the dialog box
(<var>ok</var>).
</p>
<p>The indices in <var>sel</var> are 1-based.
</p>
<p>The value of <var>ok</var> is 1 if the user closed the box with the OK button,
otherwise it is 0 and <var>sel</var> is empty.
</p>
<p>Input arguments are specified in form of <var>key</var>, <var>value</var> pairs.
The <code>&quot;ListString&quot;</code> argument pair <strong>must</strong> be specified.
</p>
<p>Valid <var>key</var> and <var>value</var> pairs are:
</p>
<dl compact="compact">
<dt><code>&quot;ListString&quot;</code></dt>
<dd><p>a cell array of strings specifying the items to list in the dialog.
</p>
</dd>
<dt><code>&quot;SelectionMode&quot;</code></dt>
<dd><p>can be either <code>&quot;Single&quot;</code> (only one item may be selected at a time) or
<code>&quot;Multiple&quot;</code> (default).
</p>
</dd>
<dt><code>&quot;ListSize&quot;</code></dt>
<dd><p>a two-element vector <code>[<var>width</var>, <var>height</var>]</code> specifying the size
of the list field in pixels.  The default is [160, 300].
</p>
</dd>
<dt><code>&quot;InitialValue&quot;</code></dt>
<dd><p>a vector containing 1-based indices of elements which will be pre-selected
when the list dialog is first displayed.
The default is 1 (first item).
</p>
</dd>
<dt><code>&quot;Name&quot;</code></dt>
<dd><p>a string to be used as the dialog caption.  Default is &quot;&quot;.
</p>
</dd>
<dt><code>&quot;PromptString&quot;</code></dt>
<dd><p>a cell array of strings to be displayed above the list of items.
Default is {}.
</p>
</dd>
<dt><code>&quot;OKString&quot;</code></dt>
<dd><p>a string used to label the OK button.  Default is <code>&quot;OK&quot;</code>.
</p>
</dd>
<dt><code>&quot;CancelString&quot;</code></dt>
<dd><p>a string used to label the Cancel button.  Default is <code>&quot;Cancel&quot;</code>.
</p></dd>
</dl>

<p>Example:
</p>
<div class="example">
<pre class="example">my_options = {&quot;An item&quot;, &quot;another&quot;, &quot;yet another&quot;};
[sel, ok] = listdlg (&quot;ListString&quot;, my_options,
                     &quot;SelectionMode&quot;, &quot;Multiple&quot;);
if (ok == 1)
  disp (&quot;You selected:&quot;);
  for i = 1:numel (sel)
    disp (sprintf (&quot;\t%s&quot;, my_options{sel(i)}));
  endfor
else
  disp (&quot;You cancelled.&quot;);
endif
</pre></div>


<p><strong>See also:</strong> <a href="Terminal-Input.html#XREFmenu">menu</a>, <a href="#XREFerrordlg">errordlg</a>, <a href="#XREFhelpdlg">helpdlg</a>, <a href="#XREFinputdlg">inputdlg</a>, <a href="#XREFmsgbox">msgbox</a>, <a href="#XREFquestdlg">questdlg</a>, <a href="#XREFwarndlg">warndlg</a>.
</p></dd></dl>


<span id="index-dialog_002c-displaying-a-message-dialog"></span>
<span id="XREFmsgbox"></span><dl>
<dt id="index-msgbox">: <em><var>h</var> =</em> <strong>msgbox</strong> <em>(<var>msg</var>)</em></dt>
<dt id="index-msgbox-1">: <em><var>h</var> =</em> <strong>msgbox</strong> <em>(<var>msg</var>, <var>title</var>)</em></dt>
<dt id="index-msgbox-2">: <em><var>h</var> =</em> <strong>msgbox</strong> <em>(<var>msg</var>, <var>title</var>, <var>icon</var>)</em></dt>
<dt id="index-msgbox-3">: <em><var>h</var> =</em> <strong>msgbox</strong> <em>(<var>msg</var>, <var>title</var>, &quot;custom&quot;, <var>cdata</var>)</em></dt>
<dt id="index-msgbox-4">: <em><var>h</var> =</em> <strong>msgbox</strong> <em>(<var>msg</var>, <var>title</var>, &quot;custom&quot;, <var>cdata</var>, <var>colormap</var>)</em></dt>
<dt id="index-msgbox-5">: <em><var>h</var> =</em> <strong>msgbox</strong> <em>(&hellip;, <var>opt</var>)</em></dt>
<dd><p>Display <var>msg</var> using a message dialog box.
</p>
<p>The message may have multiple lines separated by newline characters (&quot;\n&quot;),
or it may be a cellstr array with one element for each line.
</p>
<p>The optional input <var>title</var> (character string) can be used to decorate
the dialog caption.
</p>
<p>The optional argument <var>icon</var> selects a dialog icon.
It can be one of <code>&quot;none&quot;</code> (default), <code>&quot;error&quot;</code>, <code>&quot;help&quot;</code>,
<code>&quot;warn&quot;</code>, or <code>&quot;custom&quot;</code>.  The latter must be followed by an
image array <var>cdata</var>, and for indexed images the associated colormap.
</p>
<p>The final optional argument <var>opt</var> controls the behavior of the dialog.
If <var>opt</var> is a string, it may be one of
</p>
<dl compact="compact">
<dt><code>&quot;non-modal&quot;</code> (default)</dt>
<dd><p>The dialog is normal.
</p>
</dd>
<dt><code>&quot;modal&quot;</code></dt>
<dd><p>If any dialogs already exist with the same title, the most recent is reused
and all others are closed.  The dialog is displayed <code>&quot;modal&quot;</code> which
means it prevents users from interacting with any other GUI element until
the dialog has been closed.
</p>
</dd>
<dt><code>&quot;replace&quot;</code></dt>
<dd><p>If any dialogs already exist with the same title, the most recent is reused
and all others are closed.  The resulting dialog is set <code>&quot;non-modal&quot;</code>.
</p></dd>
</dl>

<p>If <var>opt</var> is a structure, it must contain fields <code>&quot;WindowStyle&quot;</code>
and <code>&quot;Interpreter&quot;</code>:
</p>
<dl compact="compact">
<dt><code>&quot;WindowStyle&quot;</code></dt>
<dd><p>The value must be <code>&quot;non-modal&quot;</code>, <code>&quot;modal&quot;</code>, or
<code>&quot;replace&quot;</code>.  See above.
</p>
</dd>
<dt><code>&quot;Interpreter&quot;</code></dt>
<dd><p>Controls the <code>&quot;interpreter&quot;</code> property of the text object used for
displaying the message.  The value must be <code>&quot;tex&quot;</code> (default),
<code>&quot;none&quot;</code>, or <code>&quot;latex&quot;</code>.
</p></dd>
</dl>

<p>The return value <var>h</var> is a handle to the figure object used for building
the dialog.
</p>
<p>Examples:
</p>
<div class="example">
<pre class="example">msgbox (&quot;Some message for the user.&quot;);
msgbox (&quot;Some message\nwith two lines.&quot;);
msgbox ({&quot;Some message&quot;, &quot;with two lines.&quot;});
msgbox (&quot;Some message for the user.&quot;, &quot;Fancy caption&quot;);

## A message dialog box with error icon
msgbox (&quot;Some message for the user.&quot;, &quot;Fancy caption&quot;, &quot;error&quot;);
</pre></div>


<p><strong>See also:</strong> <a href="#XREFerrordlg">errordlg</a>, <a href="#XREFhelpdlg">helpdlg</a>, <a href="#XREFinputdlg">inputdlg</a>, <a href="#XREFlistdlg">listdlg</a>, <a href="#XREFquestdlg">questdlg</a>, <a href="#XREFwarndlg">warndlg</a>.
</p></dd></dl>


<span id="index-dialog_002c-displaying-a-question-dialog"></span>
<span id="XREFquestdlg"></span><dl>
<dt id="index-questdlg">: <em><var>btn</var> =</em> <strong>questdlg</strong> <em>(<var>msg</var>)</em></dt>
<dt id="index-questdlg-1">: <em><var>btn</var> =</em> <strong>questdlg</strong> <em>(<var>msg</var>, <var>title</var>)</em></dt>
<dt id="index-questdlg-2">: <em><var>btn</var> =</em> <strong>questdlg</strong> <em>(<var>msg</var>, <var>title</var>, <var>default</var>)</em></dt>
<dt id="index-questdlg-3">: <em><var>btn</var> =</em> <strong>questdlg</strong> <em>(<var>msg</var>, <var>title</var>, <var>btn1</var>, <var>btn2</var>, <var>default</var>)</em></dt>
<dt id="index-questdlg-4">: <em><var>btn</var> =</em> <strong>questdlg</strong> <em>(<var>msg</var>, <var>title</var>, <var>btn1</var>, <var>btn2</var>, <var>btn3</var>, <var>default</var>)</em></dt>
<dd><p>Display <var>msg</var> using a question dialog box and return the caption of
the activated button.
</p>
<p>The message may have multiple lines separated by newline characters (&quot;\n&quot;),
or it may be a cellstr array with one element for each line.
</p>
<p>The optional <var>title</var> (character string) can be used to specify the
dialog caption.  It defaults to <code>&quot;Question Dialog&quot;</code>.
</p>
<p>The dialog may contain two or three buttons which will all close the dialog.
</p>
<p>The string <var>default</var> identifies the default button, which is activated
by pressing the <tt class="key">ENTER</tt> key.  It must match one of the strings given
in <var>btn1</var>, <var>btn2</var>, or <var>btn3</var>.
</p>
<p>If only <var>msg</var> and <var>title</var> are specified, three buttons with the
default captions <code>&quot;Yes&quot;</code>, <code>&quot;No&quot;</code>, and <code>&quot;Cancel&quot;</code> are used.
</p>
<p>If only two button captions, <var>btn1</var> and <var>btn2</var>, are specified the
dialog will have only these two buttons.
</p>
<p>Examples:
</p>
<div class="example">
<pre class="example">btn = questdlg (&quot;Close Octave?&quot;, &quot;Some fancy title&quot;, ...
                &quot;Yes&quot;, &quot;No&quot;, &quot;No&quot;);
if (strcmp (btn, &quot;Yes&quot;))
  exit ();
endif
</pre></div>


<p><strong>See also:</strong> <a href="#XREFerrordlg">errordlg</a>, <a href="#XREFhelpdlg">helpdlg</a>, <a href="#XREFinputdlg">inputdlg</a>, <a href="#XREFlistdlg">listdlg</a>, <a href="#XREFmsgbox">msgbox</a>, <a href="#XREFwarndlg">warndlg</a>.
</p></dd></dl>


<span id="index-dialog_002c-displaying-a-warning-dialog"></span>
<span id="XREFwarndlg"></span><dl>
<dt id="index-warndlg">: <em></em> <strong>warndlg</strong> <em>()</em></dt>
<dt id="index-warndlg-1">: <em></em> <strong>warndlg</strong> <em>(<var>msg</var>)</em></dt>
<dt id="index-warndlg-2">: <em></em> <strong>warndlg</strong> <em>(<var>msg</var>, <var>title</var>)</em></dt>
<dt id="index-warndlg-3">: <em></em> <strong>warndlg</strong> <em>(<var>msg</var>, <var>title</var>, <var>opt</var>)</em></dt>
<dt id="index-warndlg-4">: <em><var>h</var> =</em> <strong>warndlg</strong> <em>(&hellip;)</em></dt>
<dd><p>Display a warning dialog box with warning message <var>msg</var> and caption
<var>title</var>.
</p>
<p>The default warning message is
<code>&quot;This is the default warning string.&quot;</code> and the default caption is
<code>&quot;Warning Dialog&quot;</code>.
</p>
<p>The warning message may have multiple lines separated by newline characters
(&quot;\n&quot;), or it may be a cellstr array with one element for each line.
</p>
<p>The third optional argument <var>opt</var> controls the behavior of the dialog.
See <code>msgbox</code> for details.
</p>
<p>The return value <var>h</var> is a handle to the figure object used for
building the dialog.
</p>
<p>Examples:
</p>
<div class="example">
<pre class="example">warndlg (&quot;Some warning text for the user.&quot;);
warndlg (&quot;Some warning text\nwith two lines.&quot;);
warndlg ({&quot;Some warning text&quot;, &quot;with two lines.&quot;});
warndlg (&quot;Some warning text for the user.&quot;, &quot;Fancy caption&quot;);
</pre></div>


<p><strong>See also:</strong> <a href="#XREFerrordlg">errordlg</a>, <a href="#XREFhelpdlg">helpdlg</a>, <a href="#XREFmsgbox">msgbox</a>, <a href="#XREFinputdlg">inputdlg</a>, <a href="#XREFlistdlg">listdlg</a>, <a href="#XREFquestdlg">questdlg</a>.
</p></dd></dl>


<span id="index-dialog_002c-displaying-a-font-selection-dialog"></span>
<span id="XREFuisetfont"></span><dl>
<dt id="index-uisetfont">: <em></em> <strong>uisetfont</strong> <em>()</em></dt>
<dt id="index-uisetfont-1">: <em></em> <strong>uisetfont</strong> <em>(<var>h</var>)</em></dt>
<dt id="index-uisetfont-2">: <em></em> <strong>uisetfont</strong> <em>(<var>fontstruct</var>)</em></dt>
<dt id="index-uisetfont-3">: <em></em> <strong>uisetfont</strong> <em>(&hellip;, <var>title</var>)</em></dt>
<dt id="index-uisetfont-4">: <em><var>fontstruct</var> =</em> <strong>uisetfont</strong> <em>(&hellip;)</em></dt>
<dd><p>Open a font selection dialog.
</p>
<p>If the first argument is a handle to a text, axes, or uicontrol object,
pressing the OK button will change the font properties of the object.
</p>
<p>The first argument may also be a structure with fields <code>FontName</code>,
<code>FontWeight</code>, <code>FontAngle</code>, <code>FontUnits</code>, and <code>FontSize</code>,
indicating the initially selected font.
</p>
<p>The title of the dialog window can be changed using the last argument
<var>title</var>.
</p>
<p>If an output argument <var>fontstruct</var> is requested, the selected font
structure is returned.  Otherwise, the font information is displayed
onscreen.
</p>

<p><strong>See also:</strong> <a href="Plot-Annotations.html#XREFtext">text</a>, <a href="Graphics-Objects.html#XREFaxes">axes</a>, <a href="UI-Elements.html#XREFuicontrol">uicontrol</a>.
</p></dd></dl>


<p>For creating new dialog types, there is a dialog function.
</p>
<span id="index-dialog_002c-displaying-a-modal-dialog"></span>
<span id="XREFdialog"></span><dl>
<dt id="index-dialog">: <em><var>h</var> =</em> <strong>dialog</strong> <em>()</em></dt>
<dt id="index-dialog-1">: <em><var>h</var> =</em> <strong>dialog</strong> <em>(&quot;<var>property</var>&quot;, <var>value</var>, &hellip;)</em></dt>
<dd>
<p>Create an empty modal dialog window to which other uicontrols can be added.
</p>
<p>The dialog box is a figure object with properties as recommended for a
dialog box.
</p>
<p>The default properties differing from a figure are:
</p>
<dl compact="compact">
<dt>buttondownfcn</dt>
<dd><p><code>if isempty (allchild(gcbf)), close (gcbf), endif</code>
</p>
</dd>
<dt>colormap</dt>
<dd><p>[]
</p>
</dd>
<dt>color</dt>
<dd><p>defaultuicontrolbackgroundcolor
</p>
</dd>
<dt>dockcontrols</dt>
<dd><p>off
</p>
</dd>
<dt>handlevisibility</dt>
<dd><p>callback
</p>
</dd>
<dt>integerhandle</dt>
<dd><p>off
</p>
</dd>
<dt>inverthardcopy</dt>
<dd><p>off
</p>
</dd>
<dt>menubar</dt>
<dd><p>none
</p>
</dd>
<dt>numbertitle</dt>
<dd><p>off
</p>
</dd>
<dt>paperpositionmode</dt>
<dd><p>auto
</p>
</dd>
<dt>resize</dt>
<dd><p>off
</p>
</dd>
<dt>windowstyle</dt>
<dd><p>modal
</p>
</dd>
</dl>


<p>Multiple property-value pairs may be specified for the dialog object, but
they must appear in pairs.  The full list of properties is documented at
<a href="Figure-Properties.html">Figure Properties</a>.
</p>
<p>The return value <var>h</var> is a graphics handle to the created figure.
</p>
<p>Example:
</p>
<div class="example">
<pre class="example">## create an empty dialog window titled &quot;Dialog Example&quot;
h = dialog (&quot;name&quot;, &quot;Dialog Example&quot;);

## create a button (default style)
b = uicontrol (h, &quot;string&quot;, &quot;OK&quot;,
                  &quot;position&quot;, [10 10 150 40],
                  &quot;callback&quot;, &quot;delete (gcf)&quot;);

## wait for dialog to resume or close
uiwait (h);
</pre></div>


<p><strong>See also:</strong> <a href="#XREFerrordlg">errordlg</a>, <a href="#XREFmsgbox">msgbox</a>, <a href="#XREFquestdlg">questdlg</a>, <a href="#XREFwarndlg">warndlg</a>, <a href="Multiple-Plot-Windows.html#XREFfigure">figure</a>, <a href="GUI-Utility-Functions.html#XREFuiwait">uiwait</a>.
</p></dd></dl>


<hr>
<div class="header">
<p>
Next: <a href="Progress-Bar.html" accesskey="n" rel="next">Progress Bar</a>, Up: <a href="GUI-Development.html" accesskey="u" rel="up">GUI Development</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>