File: UI-Elements.html

package info (click to toggle)
octave 10.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 145,388 kB
  • sloc: cpp: 335,976; ansic: 82,241; fortran: 20,963; objc: 9,402; sh: 8,756; yacc: 4,392; lex: 4,333; perl: 1,544; java: 1,366; awk: 1,259; makefile: 659; xml: 192
file content (730 lines) | stat: -rw-r--r-- 41,515 bytes parent folder | download | duplicates (2)
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
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
<!DOCTYPE html>
<html>
<!-- Created by GNU Texinfo 7.1.1, https://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>UI Elements (GNU Octave (version 10.3.0))</title>

<meta name="description" content="UI Elements (GNU Octave (version 10.3.0))">
<meta name="keywords" content="UI Elements (GNU Octave (version 10.3.0))">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta name="viewport" content="width=device-width,initial-scale=1">

<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="GUI-Utility-Functions.html" rel="next" title="GUI Utility Functions">
<link href="Progress-Bar.html" rel="prev" title="Progress Bar">
<style type="text/css">
<!--
a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
div.example {margin-left: 3.2em}
span:hover a.copiable-link {visibility: visible}
strong.def-name {font-family: monospace; font-weight: bold; font-size: larger}
-->
</style>
<link rel="stylesheet" type="text/css" href="octave.css">


</head>

<body lang="en">
<div class="section-level-extent" id="UI-Elements">
<div class="nav-panel">
<p>
Next: <a href="GUI-Utility-Functions.html" accesskey="n" rel="next">GUI Utility Functions</a>, Previous: <a href="Progress-Bar.html" accesskey="p" rel="prev">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>
<h3 class="section" id="UI-Elements-1"><span>35.3 UI Elements<a class="copiable-link" href="#UI-Elements-1"> &para;</a></span></h3>

<p>The ui* series of functions work best with the <code class="code">qt</code> graphics
toolkit, although some functionality is available with the <code class="code">fltk</code> toolkit.
There is no support for the <code class="code">gnuplot</code> toolkit.
</p>
<a class="anchor" id="XREFuifigure"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-uifigure"><span><code class="def-type"><var class="var">h</var> =</code> <strong class="def-name">uifigure</strong> <code class="def-code-arguments">()</code><a class="copiable-link" href="#index-uifigure"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-uifigure-1"><span><code class="def-type"><var class="var">h</var> =</code> <strong class="def-name">uifigure</strong> <code class="def-code-arguments">(&quot;<var class="var">property</var>&quot;, <var class="var">value</var>, &hellip;)</code><a class="copiable-link" href="#index-uifigure-1"> &para;</a></span></dt>
<dd><p>Create a new figure window for applications.
</p>
<p>Multiple property-value pairs may be specified for the figure object, but
they must occur in pairs.
</p>
<p>The return value <var class="var">h</var> is a graphics handle to the created figure object.
</p>
<p>Programming Note: The full list of properties is documented at
<a class="ref" href="Figure-Properties.html">Figure Properties</a>.  This function differs from <code class="code">figure</code> in that
the created figure is optimized for application development, rather than
plotting.  This means features such as menubars and toolbars are turned off.
This is not perfect replacement for the <small class="sc">MATLAB</small> uifigure object as the
properties <code class="code">&quot;AutoResizeChildren&quot;</code>, <code class="code">&quot;Icon&quot;</code>, and
<code class="code">&quot;Scrollable&quot;</code> are not implemented.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFuipanel">uipanel</a>, <a class="ref" href="#XREFuibuttongroup">uibuttongroup</a>.
</p></dd></dl>


<a class="anchor" id="XREFuipanel"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-uipanel"><span><code class="def-type"><var class="var">hui</var> =</code> <strong class="def-name">uipanel</strong> <code class="def-code-arguments">()</code><a class="copiable-link" href="#index-uipanel"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-uipanel-1"><span><code class="def-type"><var class="var">hui</var> =</code> <strong class="def-name">uipanel</strong> <code class="def-code-arguments">(<var class="var">property</var>, <var class="var">value</var>, &hellip;)</code><a class="copiable-link" href="#index-uipanel-1"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-uipanel-2"><span><code class="def-type"><var class="var">hui</var> =</code> <strong class="def-name">uipanel</strong> <code class="def-code-arguments">(<var class="var">parent</var>)</code><a class="copiable-link" href="#index-uipanel-2"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-uipanel-3"><span><code class="def-type"><var class="var">hui</var> =</code> <strong class="def-name">uipanel</strong> <code class="def-code-arguments">(<var class="var">parent</var>, <var class="var">property</var>, <var class="var">value</var>, &hellip;)</code><a class="copiable-link" href="#index-uipanel-3"> &para;</a></span></dt>
<dd>
<p>Create a uipanel object.
</p>
<p>uipanels are used as containers to group other uicontrol objects.
</p>
<p>If <var class="var">parent</var> is omitted then a uipanel for the current figure is
created.  If no figure is available, a new figure is created first.
</p>
<p>If <var class="var">parent</var> is given then a uipanel relative to <var class="var">parent</var> is created.
</p>
<p>Any provided property value pairs will override the default values of the
created uipanel object.
</p>
<p>The full list of properties is documented at <a class="ref" href="Uipanel-Properties.html">Uipanel Properties</a>.
</p>
<p>The optional return value <var class="var">hui</var> is a graphics handle to the created
uipanel object.
</p>
<p>Examples:
</p>
<div class="example">
<div class="group"><pre class="example-preformatted">## create figure and panel on it
f = figure;
p = uipanel (&quot;title&quot;, &quot;Panel Title&quot;, &quot;position&quot;, [.25 .25 .5 .5]);

## add two buttons to the panel
b1 = uicontrol (&quot;parent&quot;, p, &quot;string&quot;, &quot;A Button&quot;, ...
                &quot;position&quot;, [18 10 150 36]);
b2 = uicontrol (&quot;parent&quot;, p, &quot;string&quot;, &quot;Another Button&quot;, ...
                &quot;position&quot;,[18 60 150 36]);

</pre></div></div>

<p><strong class="strong">See also:</strong> <a class="ref" href="Multiple-Plot-Windows.html#XREFfigure">figure</a>, <a class="ref" href="#XREFuicontrol">uicontrol</a>.
</p></dd></dl>


<a class="anchor" id="XREFuibuttongroup"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-uibuttongroup"><span><code class="def-type"><var class="var">hui</var> =</code> <strong class="def-name">uibuttongroup</strong> <code class="def-code-arguments">()</code><a class="copiable-link" href="#index-uibuttongroup"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-uibuttongroup-1"><span><code class="def-type"><var class="var">hui</var> =</code> <strong class="def-name">uibuttongroup</strong> <code class="def-code-arguments">(<var class="var">property</var>, <var class="var">value</var>, &hellip;)</code><a class="copiable-link" href="#index-uibuttongroup-1"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-uibuttongroup-2"><span><code class="def-type"><var class="var">hui</var> =</code> <strong class="def-name">uibuttongroup</strong> <code class="def-code-arguments">(<var class="var">parent</var>)</code><a class="copiable-link" href="#index-uibuttongroup-2"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-uibuttongroup-3"><span><code class="def-type"><var class="var">hui</var> =</code> <strong class="def-name">uibuttongroup</strong> <code class="def-code-arguments">(<var class="var">parent</var>, <var class="var">property</var>, <var class="var">value</var>, &hellip;)</code><a class="copiable-link" href="#index-uibuttongroup-3"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-uibuttongroup-4"><span><strong class="def-name">uibuttongroup</strong> <code class="def-code-arguments">(<var class="var">h</var>)</code><a class="copiable-link" href="#index-uibuttongroup-4"> &para;</a></span></dt>
<dd>
<p>Create a uibuttongroup object and return a handle to it.
</p>
<p>A uibuttongroup is used to group uicontrol objects.
</p>
<p>If <var class="var">parent</var> is omitted then a uibuttongroup for the current figure is
created.  If no figure is available, a new figure is created first.
</p>
<p>If <var class="var">parent</var> is given then a uibuttongroup relative to <var class="var">parent</var> is
created.
</p>
<p>Any provided property value pairs will override the default values of the
created uibuttongroup object.
</p>
<p>The full list of properties is documented at <a class="ref" href="Uibuttongroup-Properties.html">Uibuttongroup Properties</a>.
</p>
<p>Examples:
</p>
<div class="example">
<div class="group"><pre class="example-preformatted">## Create figure and panel on it
f = figure;
## Create a button group
gp = uibuttongroup (f, &quot;Position&quot;, [ 0 0.5 1 1])
## Create a buttons in the group
b1 = uicontrol (gp, &quot;style&quot;, &quot;radiobutton&quot;, ...
                &quot;string&quot;, &quot;Choice 1&quot;, ...
                &quot;Position&quot;, [ 10 150 100 50 ]);
b2 = uicontrol (gp, &quot;style&quot;, &quot;radiobutton&quot;, ...
                &quot;string&quot;, &quot;Choice 2&quot;, ...
                &quot;Position&quot;, [ 10 50 100 30 ]);
## Create a button not in the group
b3 = uicontrol (f, &quot;style&quot;, &quot;radiobutton&quot;, ...
                &quot;string&quot;, &quot;Not in the group&quot;, ...
                &quot;Position&quot;, [ 10 50 100 50 ]);
</pre></div></div>

<p>When called with a single argument <var class="var">h</var> which is a handle to an existing
uibuttongroup object, switch the focus to the specified uibuttongroup.  This
functionality is not currently implemented.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="Multiple-Plot-Windows.html#XREFfigure">figure</a>, <a class="ref" href="#XREFuipanel">uipanel</a>.
</p></dd></dl>


<a class="anchor" id="XREFuicontrol"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-uicontrol"><span><code class="def-type"><var class="var">hui</var> =</code> <strong class="def-name">uicontrol</strong> <code class="def-code-arguments">()</code><a class="copiable-link" href="#index-uicontrol"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-uicontrol-1"><span><code class="def-type"><var class="var">hui</var> =</code> <strong class="def-name">uicontrol</strong> <code class="def-code-arguments">(<var class="var">property</var>, <var class="var">value</var>, &hellip;)</code><a class="copiable-link" href="#index-uicontrol-1"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-uicontrol-2"><span><code class="def-type"><var class="var">hui</var> =</code> <strong class="def-name">uicontrol</strong> <code class="def-code-arguments">(<var class="var">parent</var>)</code><a class="copiable-link" href="#index-uicontrol-2"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-uicontrol-3"><span><code class="def-type"><var class="var">hui</var> =</code> <strong class="def-name">uicontrol</strong> <code class="def-code-arguments">(<var class="var">parent</var>, <var class="var">property</var>, <var class="var">value</var>, &hellip;)</code><a class="copiable-link" href="#index-uicontrol-3"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-uicontrol-4"><span><strong class="def-name">uicontrol</strong> <code class="def-code-arguments">(<var class="var">h</var>)</code><a class="copiable-link" href="#index-uicontrol-4"> &para;</a></span></dt>
<dd>
<p>Create a uicontrol object and return a handle to it.
</p>
<p>A uicontrol object is used to create simple interactive controls such as
push buttons, checkboxes, edit and list controls.
</p>
<p>If <var class="var">parent</var> is omitted then a uicontrol for the current figure is
created.  If no figure is available, a new figure is created first.
</p>
<p>If <var class="var">parent</var> is given then a uicontrol relative to <var class="var">parent</var> is
created.
</p>
<p>Any provided property value pairs will override the default values of the
created uicontrol object.
</p>
<p>The full list of properties is documented at <a class="ref" href="Uicontrol-Properties.html">Uicontrol Properties</a>.
</p>
<p>The type of uicontrol created is specified by the <var class="var">style</var> property.  If
no style property is provided, a push button will be created.
</p>
<p>Valid styles for uicontrol are:
</p>
<dl class="table">
<dt><code class="code">&quot;checkbox&quot;</code></dt>
<dd><p>Create a checkbox control that allows user on/off selection.
</p>
</dd>
<dt><code class="code">&quot;edit&quot;</code></dt>
<dd><p>Create an edit control that allows user input of single or multiple lines
of text.
</p>
</dd>
<dt><code class="code">&quot;listbox&quot;</code></dt>
<dd><p>Create a listbox control that displays a list of items and allows user
selection of single or multiple items.
</p>
</dd>
<dt><code class="code">&quot;popupmenu&quot;</code></dt>
<dd><p>Create a popupmenu control that displays a list of options that can be
selected when the user clicks on the control.
</p>
</dd>
<dt><code class="code">&quot;pushbutton&quot;</code></dt>
<dd><p>Create a push button control that allows user to press to cause an action.
</p>
</dd>
<dt><code class="code">&quot;radiobutton&quot;</code></dt>
<dd><p>Create a radio button control intended to be used for mutually exclusive
input in a group of radiobutton controls.
</p>
</dd>
<dt><code class="code">&quot;slider&quot;</code></dt>
<dd><p>Create a slider control that allows user selection from a range of values
by sliding knob on the control.
</p>
</dd>
<dt><code class="code">&quot;text&quot;</code></dt>
<dd><p>Create a static text control to display single or multiple lines of text.
</p>
</dd>
<dt><code class="code">&quot;togglebutton&quot;</code></dt>
<dd><p>Create a toggle button control that appears like a push button but allows
the user to select between two states.
</p>
</dd>
</dl>

<p>Note: For the <code class="code">&quot;edit&quot;</code> and <code class="code">&quot;listbox&quot;</code> styles, the single or
multiple line/selection behavior is determined by the <code class="code">&quot;Min&quot;</code> and
<code class="code">&quot;Max&quot;</code> properties, permitting multiple lines/selections when the
values are set such that <code class="code">Max&nbsp;-&nbsp;Min&nbsp;&gt;&nbsp;1</code><!-- /@w -->.
</p>
<p>Examples:
</p>
<div class="example">
<div class="group"><pre class="example-preformatted">## Create figure and panel on it
f = figure;
## Create a button (default style)
b1 = uicontrol (f, &quot;string&quot;, &quot;A Button&quot;, ...
                   &quot;position&quot;, [10 10 150 40]);
## Create an edit control
e1 = uicontrol (f, &quot;style&quot;, &quot;edit&quot;, &quot;string&quot;, &quot;editable text&quot;, ...
                   &quot;position&quot;, [10 60 300 40]);
## Create a checkbox
c1 = uicontrol (f, &quot;style&quot;, &quot;checkbox&quot;, &quot;string&quot;, &quot;a checkbox&quot;, ...
                   &quot;position&quot;, [10 120 150 40]);
</pre></div></div>

<p>When called with a single argument <var class="var">h</var> which is a handle to an existing
uicontrol object, switch the keyboard focus to the specified
uicontrol.  As a result, the uicontrol object will receive keyboard
events that can be processed using the <code class="code">&quot;keypressfcn&quot;</code> callback.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="Multiple-Plot-Windows.html#XREFfigure">figure</a>, <a class="ref" href="#XREFuipanel">uipanel</a>.
</p></dd></dl>


<a class="anchor" id="XREFuitable"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-uitable"><span><code class="def-type"><var class="var">hui</var> =</code> <strong class="def-name">uitable</strong> <code class="def-code-arguments">(<var class="var">property</var>, <var class="var">value</var>, &hellip;)</code><a class="copiable-link" href="#index-uitable"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-uitable-1"><span><code class="def-type"><var class="var">hui</var> =</code> <strong class="def-name">uitable</strong> <code class="def-code-arguments">(<var class="var">parent</var>, <var class="var">property</var>, <var class="var">value</var>, &hellip;)</code><a class="copiable-link" href="#index-uitable-1"> &para;</a></span></dt>
<dd><p>Create a uitable object and return a handle to it.
</p>
<p>A uitable object is used to show tables of data in a figure window.
</p>
<p>If <var class="var">parent</var> is omitted then a uitable for the current figure is
created.  If no figure is available, a new figure is created first.
</p>
<p>If <var class="var">parent</var> is given then a uitable relative to <var class="var">parent</var> is
created.
</p>
<p>Any provided property value pairs will override the default values of the
created uitable object.
</p>
<p>The full list of properties is documented at <a class="ref" href="Uitable-Properties.html">Uitable Properties</a>.
</p>
<p>Examples:
</p>
<div class="example smallexample">
<div class="group"><pre class="example-preformatted">## Create figure and place a table on it
f = figure ();
m = magic (8);
t = uitable (f, &quot;Data&quot;, m, &quot;ColumnWidth&quot;, { 40 });
</pre></div><pre class="example-preformatted">

</pre><div class="group"><pre class="example-preformatted">## Create a table with labeled rows and columns
f = figure ();
d = reshape (1:9, [3, 3]);
row_names = { &quot;Row1&quot;, &quot;Row2&quot;, &quot;Row3&quot; };
col_names = { &quot;Col1&quot;, &quot;Col2&quot;, &quot;Col3&quot; };
t = uitable (f, &quot;Data&quot;, d, ...
             &quot;RowName&quot;, row_names, &quot;ColumnName&quot;, col_names);

p = get (t, &quot;Position&quot;);
e = get (t, &quot;Extent&quot;);
p(3:4) = e(3:4);
set (t, &quot;Position&quot;, p);
</pre></div><pre class="example-preformatted">

## Long demo with callbacks
function uitable_demo ()
  f = figure (&quot;Name&quot;, &quot;uitable Demo&quot;, &quot;Menu&quot;, &quot;none&quot;, ...
              &quot;Position&quot;, [10 10 1000 680]);

  ## A basic example
  d = { &quot;char&quot;   , &quot;A string&quot;;
        &quot;double&quot; , 12.3456789;
        &quot;complex&quot;, 1+2i;
        &quot;bool&quot;   , true;
        &quot;single&quot; , single(12.3456789);
        &quot;int8&quot;   , int8(-128);
        &quot;uint8&quot;  , uint8(128);
        &quot;int16&quot;  , int16(-32768);
        &quot;uint16&quot; , uint16(32768);
        &quot;int32&quot;  , int32(-2147483648);
        &quot;uint32&quot; , uint32(2147483648);
        &quot;int64&quot;  , int64(-2147483649);
        &quot;uint64&quot; , uint64(2147843649)};

  popup_options = {&quot;A&quot;, &quot;B&quot;, &quot;C&quot;, &quot;D&quot;, &quot;E&quot;};

  columnformat_options = { &quot;[]&quot;, &quot;char&quot;, &quot;pop-up&quot;, &quot;numeric&quot;, ...
                           &quot;short&quot;, &quot;short e&quot;, &quot;short eng&quot;, ...
                           &quot;short g&quot;, &quot;long&quot;, &quot;long e&quot;, ...
                           &quot;long eng&quot;, &quot;long g&quot;, &quot;bank&quot;, &quot;+&quot;, ...
                           &quot;rat&quot;, &quot;logical&quot;};
  columnformat_values = columnformat_options;
  columnformat_values{1} = &quot;&quot;;
  columnformat_values{3} = popup_options;

  default_data = repmat (d(:,2), 1, columns (columnformat_options));
  b_add = uicontrol (f, &quot;Position&quot;, [285 630 600 50], ...
            &quot;UserData&quot;, [rows(d), 1], ...
            &quot;Style&quot;, &quot;pushbutton&quot;, ...
            &quot;String&quot;, &quot;Set data at selected point to selected datatype&quot;);

  l_type_table = uicontrol (f, &quot;Position&quot;, [ 0 603 120 25 ], ...
      &quot;String&quot;, &quot;Datatype Table:&quot;, ...
      &quot;Style&quot;, &quot;text&quot;);
  t_type_table = uitable (f, &quot;Position&quot;, [ 0 530 1000 70 ], ...
      &quot;Data&quot;, transpose (d(:, 2)), ...
      &quot;ColumnName&quot;, transpose (d(:, 1)), ...
      &quot;RowName&quot;, &quot;Value&quot;, ...
      &quot;CellSelectionCallback&quot;, ...
@(x, y) set (b_add, &quot;UserData&quot;, y.Indices ));

  l_point_table = uicontrol (f, &quot;Position&quot;, [ 0 640 60 25 ], ...
      &quot;String&quot;, &quot;Point:&quot;, ...
      &quot;Style&quot;, &quot;text&quot;);
  t_point_table = uitable (f, &quot;Position&quot;, [ 80 630 160 42 ], ...
      &quot;RowName&quot;, [], ...
      &quot;ColumnName&quot;, {&quot;x&quot;, &quot;y&quot;}, ...
      &quot;Data&quot;, [ 1, 1 ], ...
      &quot;ColumnEditable&quot;, true);

  l_editable_table = uicontrol (f, &quot;Position&quot;, [ 0 502 200 25 ], ...
      &quot;Style&quot;, &quot;text&quot;, ...
      &quot;String&quot;, &quot;Set Data Columns Editable:&quot;);
  t_editable_table = ...
    uitable (f, &quot;Position&quot;, [ 0 434 1000 65 ], ...
                &quot;Data&quot;, repmat (false, 1, columns (default_data)), ...
                &quot;ColumnEditable&quot;, true);

  l_format_table = uicontrol (f, &quot;Position&quot;, [ 0 406 200 25 ], ...
      &quot;Style&quot;, &quot;text&quot;, ...
      &quot;String&quot;, &quot;Set Data Column Format:&quot;);
  t_format_table = ...
    uitable (f, &quot;Position&quot;, [ 0 338 1000 65 ], ...
                &quot;Data&quot;, columnformat_options, ...
                &quot;ColumnEditable&quot;, true, ...
                &quot;ColumnFormat&quot;, arrayfun (@(x) {columnformat_options}, ...
                                          1:columns (columnformat_options)));

  l_data_table = uicontrol (f, &quot;Style&quot;, &quot;text&quot;, ...
                               &quot;String&quot;, &quot;Data:&quot;, ...
                               &quot;Position&quot;, [ 0 310 60 25 ]);
  t_data_table = uitable (f, &quot;Position&quot;, [ 0 15 1000 290 ], ...
      &quot;Data&quot;, default_data, ...
      &quot;ColumnFormat&quot;, columnformat_values);

  set (t_format_table, ...
       &quot;CellEditCallback&quot;, ...
@(x, y) update_column_format (y.NewData, y.Indices, ...
                                      t_data_table, popup_options));
  set (t_point_table, &quot;CellEditCallback&quot;, ...
@(x, y) validate_point_table (x, y, t_data_table));
  set (t_editable_table, &quot;CellEditCallback&quot;, ...
@(x,y) set (t_data_table, ...
                    &quot;ColumnEditable&quot;, get (t_editable_table, &quot;Data&quot;)));
  set (b_add, ...
       &quot;Callback&quot;, @(x, y) update_data (b_add, t_point_table, ...
                                         t_type_table, t_data_table));
  set (t_data_table, &quot;CellSelectionCallback&quot;, ...
@(x, y) update_point_table (y.Indices, t_point_table));
endfunction

</pre><div class="group"><pre class="example-preformatted">function validate_point_table (h, dat, t_data_table)
  if (! (dat.NewData &gt; 0 &amp;&amp; ...
    dat.NewData &lt; size (get (t_data_table, &quot;Data&quot;), dat.Indices(1, 1)) + 1))

    d = get (h, &quot;Data&quot;);
    d(dat.Indices) = 1;
    set (h, &quot;Data&quot;, d);
  endif
endfunction
</pre></div><pre class="example-preformatted">

</pre><div class="group"><pre class="example-preformatted">function update_column_format (format, indices, t_data_table, ...
                               popup_options)
  cf = get (t_data_table, &quot;ColumnFormat&quot;);
  if (strcmp (format, &quot;[]&quot;))
    format = &quot;&quot;;
  elseif (strcmp (format, &quot;pop-up&quot;))
    format = popup_options;
  endif
  cf{indices(1,2)} = format;
  set (t_data_table, &quot;ColumnFormat&quot;, cf);
endfunction
</pre></div><pre class="example-preformatted">

</pre><div class="group"><pre class="example-preformatted">function update_point_table (indices, t_point_table)
  if (isempty (indices))
    indices = [1, 1];
  endif
  set (t_point_table, &quot;Data&quot;, indices(1,:));
endfunction
</pre></div><pre class="example-preformatted">

</pre><div class="group"><pre class="example-preformatted">function update_data (b_add, t_point_table, t_type_table, ...
                      t_data_table)
  indices = get (b_add, &quot;UserData&quot;);
  if (isempty (indices))
    indices = [1, 1];
  endif
  d = get (t_data_table, &quot;Data&quot;);
  t_type_table_data = get (t_type_table, &quot;Data&quot;);
  p = get (t_point_table, &quot;Data&quot;);
  d(p(1,2), p(1,1)) = t_type_table_data(indices(1,2));
  set (t_data_table, &quot;Data&quot;, d);
endfunction
</pre></div></div>


<p><strong class="strong">See also:</strong> <a class="ref" href="Multiple-Plot-Windows.html#XREFfigure">figure</a>, <a class="ref" href="#XREFuicontrol">uicontrol</a>.
</p></dd></dl>


<a class="anchor" id="XREFuimenu"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-uimenu"><span><code class="def-type"><var class="var">hui</var> =</code> <strong class="def-name">uimenu</strong> <code class="def-code-arguments">(<var class="var">property</var>, <var class="var">value</var>, &hellip;)</code><a class="copiable-link" href="#index-uimenu"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-uimenu-1"><span><code class="def-type"><var class="var">hui</var> =</code> <strong class="def-name">uimenu</strong> <code class="def-code-arguments">(<var class="var">h</var>, <var class="var">property</var>, <var class="var">value</var>, &hellip;)</code><a class="copiable-link" href="#index-uimenu-1"> &para;</a></span></dt>
<dd><p>Create a uimenu object and return a handle to it.
</p>
<p>If <var class="var">h</var> is omitted then a top-level menu for the current figure is
created.  If <var class="var">h</var> is given then a submenu relative to <var class="var">h</var> is created.
</p>
<p>uimenu objects have the following specific properties:
</p>
<dl class="table">
<dt><code class="code">&quot;accelerator&quot;</code></dt>
<dd><p>A string containing the key, together with CTRL, to execute this
menu entry (e.g., <code class="code">&quot;x&quot;</code> for CTRL+x).
</p>
</dd>
<dt><code class="code">&quot;checked&quot;</code></dt>
<dd><p>Can be set <code class="code">&quot;on&quot;</code> or <code class="code">&quot;off&quot;</code>.  Sets a mark at this menu entry.
</p>
</dd>
<dt><code class="code">&quot;enable&quot;</code></dt>
<dd><p>Can be set <code class="code">&quot;on&quot;</code> or <code class="code">&quot;off&quot;</code>.  If disabled then the menu entry
cannot be selected and is grayed out.
</p>
</dd>
<dt><code class="code">&quot;foregroundcolor&quot;</code></dt>
<dd><p>A color value for the text of the menu entry.
</p>
</dd>
<dt><code class="code">&quot;menuselectedfcn&quot;</code></dt>
<dd><p>The function called when this menu entry is executed.  It can be either a
function string (e.g., <code class="code">&quot;myfcn&quot;</code>), a function handle (e.g.,
@myfcn) or a cell array containing the function handle and
arguments for the callback function (e.g., {@myfcn, arg1,
arg2}).
</p>
</dd>
<dt><code class="code">&quot;position&quot;</code></dt>
<dd><p>A scalar value containing the relative menu position.  The first position
has value 1 and will be either the left or top depending on the orientation
of the uimenu.
</p>
</dd>
<dt><code class="code">&quot;separator&quot;</code></dt>
<dd><p>Can be set <code class="code">&quot;on&quot;</code> or <code class="code">&quot;off&quot;</code>.  If enabled, a separator
line is drawn above the current position.  This property is ignored for
top-level entries.
</p>
</dd>
<dt><code class="code">&quot;text&quot;</code></dt>
<dd><p>A string containing the text for this menu entry.  A <code class="code">&quot;&amp;&quot;</code>-symbol
can be used to mark the <code class="code">&quot;accelerator&quot;</code> character (e.g.,
<code class="code">&quot;E&amp;xit&quot;</code>).
</p>
</dd>
</dl>

<p>The full list of properties is documented at <a class="ref" href="Uimenu-Properties.html">Uimenu Properties</a>.
</p>
<p>Examples:
</p>
<div class="example">
<div class="group"><pre class="example-preformatted">f = uimenu (&quot;text&quot;, &quot;&amp;File&quot;, &quot;accelerator&quot;, &quot;f&quot;);
e = uimenu (&quot;text&quot;, &quot;&amp;Edit&quot;, &quot;accelerator&quot;, &quot;e&quot;);
uimenu (f, &quot;text&quot;, &quot;Close&quot;, &quot;accelerator&quot;, &quot;q&quot;, ...
           &quot;menuselectedfcn&quot;, &quot;close (gcf)&quot;);
uimenu (e, &quot;text&quot;, &quot;Toggle &amp;Grid&quot;, &quot;accelerator&quot;, &quot;g&quot;, ...
           &quot;menuselectedfcn&quot;, &quot;grid (gca)&quot;);
</pre></div></div>

<p><strong class="strong">See also:</strong> <a class="ref" href="Multiple-Plot-Windows.html#XREFfigure">figure</a>.
</p></dd></dl>


<a class="anchor" id="XREFuicontextmenu"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-uicontextmenu"><span><code class="def-type"><var class="var">hui</var> =</code> <strong class="def-name">uicontextmenu</strong> <code class="def-code-arguments">(<var class="var">property</var>, <var class="var">value</var>, &hellip;)</code><a class="copiable-link" href="#index-uicontextmenu"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-uicontextmenu-1"><span><code class="def-type"><var class="var">hui</var> =</code> <strong class="def-name">uicontextmenu</strong> <code class="def-code-arguments">(<var class="var">h</var>, <var class="var">property</var>, <var class="var">value</var>, &hellip;)</code><a class="copiable-link" href="#index-uicontextmenu-1"> &para;</a></span></dt>
<dd>
<p>Create a uicontextmenu object and return a handle to it.
</p>
<p>If <var class="var">h</var> is omitted then a uicontextmenu for the current figure is
created.  If no figure is available, a new figure is created first.
</p>
<p>If <var class="var">h</var> is given then a uicontextmenu relative to <var class="var">h</var> is created.
</p>
<p>Any provided property value pairs will override the default values of the
created uicontextmenu object.
</p>
<p>The full list of properties is documented at <a class="ref" href="Uicontextmenu-Properties.html">Uicontextmenu Properties</a>.
</p>
<p>Examples:
</p>
<div class="example">
<div class="group"><pre class="example-preformatted">## create figure and uicontextmenu
f = figure ();
c = uicontextmenu (f);

## create menus in the context menu
m1 = uimenu (&quot;parent&quot;, c, &quot;label&quot;, &quot;Menu item 1&quot;, ...
             &quot;callback&quot;, &quot;disp('menu item 1')&quot;);
m2 = uimenu (&quot;parent&quot;, c, &quot;label&quot;, &quot;Menu item 2&quot;, ...
             &quot;callback&quot;, &quot;disp('menu item 2')&quot;);

## set the context menu for the figure
set (f, &quot;uicontextmenu&quot;, c);
</pre></div></div>

<p><strong class="strong">See also:</strong> <a class="ref" href="Multiple-Plot-Windows.html#XREFfigure">figure</a>, <a class="ref" href="#XREFuimenu">uimenu</a>.
</p></dd></dl>


<a class="anchor" id="XREFuitoolbar"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-uitoolbar"><span><code class="def-type"><var class="var">hui</var> =</code> <strong class="def-name">uitoolbar</strong> <code class="def-code-arguments">()</code><a class="copiable-link" href="#index-uitoolbar"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-uitoolbar-1"><span><code class="def-type"><var class="var">hui</var> =</code> <strong class="def-name">uitoolbar</strong> <code class="def-code-arguments">(<var class="var">property</var>, <var class="var">value</var>, &hellip;)</code><a class="copiable-link" href="#index-uitoolbar-1"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-uitoolbar-2"><span><code class="def-type"><var class="var">hui</var> =</code> <strong class="def-name">uitoolbar</strong> <code class="def-code-arguments">(<var class="var">parent</var>)</code><a class="copiable-link" href="#index-uitoolbar-2"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-uitoolbar-3"><span><code class="def-type"><var class="var">hui</var> =</code> <strong class="def-name">uitoolbar</strong> <code class="def-code-arguments">(<var class="var">parent</var>, <var class="var">property</var>, <var class="var">value</var>, &hellip;)</code><a class="copiable-link" href="#index-uitoolbar-3"> &para;</a></span></dt>
<dd>
<p>Create a uitoolbar object.  A uitoolbar displays uitoggletool and uipushtool
buttons.
</p>
<p>If <var class="var">parent</var> is omitted then a uitoolbar for the current figure is
created.  If no figure is available, a new figure is created first.
</p>
<p>If <var class="var">parent</var> is given then a uitoolbar relative to <var class="var">parent</var> is
created.
</p>
<p>Any provided property value pairs will override the default values of the
created uitoolbar object.
</p>
<p>The full list of properties is documented at <a class="ref" href="Uitoolbar-Properties.html">Uitoolbar Properties</a>.
</p>
<p>The optional return value <var class="var">hui</var> is a graphics handle to the created
uitoolbar object.
</p>
<p>Examples:
</p>
<div class="example">
<div class="group"><pre class="example-preformatted">% create figure without a default toolbar
f = figure (&quot;toolbar&quot;, &quot;none&quot;);
% create empty toolbar
t = uitoolbar (f);
</pre></div></div>

<p><strong class="strong">See also:</strong> <a class="ref" href="Multiple-Plot-Windows.html#XREFfigure">figure</a>, <a class="ref" href="#XREFuitoggletool">uitoggletool</a>, <a class="ref" href="#XREFuipushtool">uipushtool</a>.
</p></dd></dl>


<a class="anchor" id="XREFuipushtool"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-uipushtool"><span><code class="def-type"><var class="var">hui</var> =</code> <strong class="def-name">uipushtool</strong> <code class="def-code-arguments">()</code><a class="copiable-link" href="#index-uipushtool"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-uipushtool-1"><span><code class="def-type"><var class="var">hui</var> =</code> <strong class="def-name">uipushtool</strong> <code class="def-code-arguments">(<var class="var">property</var>, <var class="var">value</var>, &hellip;)</code><a class="copiable-link" href="#index-uipushtool-1"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-uipushtool-2"><span><code class="def-type"><var class="var">hui</var> =</code> <strong class="def-name">uipushtool</strong> <code class="def-code-arguments">(<var class="var">parent</var>)</code><a class="copiable-link" href="#index-uipushtool-2"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-uipushtool-3"><span><code class="def-type"><var class="var">hui</var> =</code> <strong class="def-name">uipushtool</strong> <code class="def-code-arguments">(<var class="var">parent</var>, <var class="var">property</var>, <var class="var">value</var>, &hellip;)</code><a class="copiable-link" href="#index-uipushtool-3"> &para;</a></span></dt>
<dd>
<p>Create a uipushtool object.
</p>
<p>uipushtools are buttons that appear on a figure toolbar.  The button is
created with a border that is shown when the user hovers over the button.
An image can be set using the cdata property.
</p>
<p>If <var class="var">parent</var> is omitted then a uipushtool for the current figure is
created.  If no figure is available, a new figure is created first.  If a
figure is available, but does not contain a uitoolbar, a uitoolbar will be
created.
</p>
<p>If <var class="var">parent</var> is given then a uipushtool is created on the <var class="var">parent</var>
uitoolbar.
</p>
<p>Any provided property value pairs will override the default values of the
created uipushtool object.
</p>
<p>The full list of properties is documented at <a class="ref" href="Uipushtool-Properties.html">Uipushtool Properties</a>.
</p>
<p>The optional return value <var class="var">hui</var> is a graphics handle to the created
uipushtool object.
</p>
<p>Examples:
</p>
<div class="example">
<div class="group"><pre class="example-preformatted">% create figure without a default toolbar
f = figure (&quot;toolbar&quot;, &quot;none&quot;);
% create empty toolbar
t = uitoolbar (f);
% create a 19x19x3 black square
img=zeros(19,19,3);
% add pushtool button to toolbar
b = uipushtool (t, &quot;cdata&quot;, img);
</pre></div></div>

<p><strong class="strong">See also:</strong> <a class="ref" href="Multiple-Plot-Windows.html#XREFfigure">figure</a>, <a class="ref" href="#XREFuitoolbar">uitoolbar</a>, <a class="ref" href="#XREFuitoggletool">uitoggletool</a>.
</p></dd></dl>


<a class="anchor" id="XREFuitoggletool"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-uitoggletool"><span><code class="def-type"><var class="var">hui</var> =</code> <strong class="def-name">uitoggletool</strong> <code class="def-code-arguments">()</code><a class="copiable-link" href="#index-uitoggletool"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-uitoggletool-1"><span><code class="def-type"><var class="var">hui</var> =</code> <strong class="def-name">uitoggletool</strong> <code class="def-code-arguments">(<var class="var">property</var>, <var class="var">value</var>, &hellip;)</code><a class="copiable-link" href="#index-uitoggletool-1"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-uitoggletool-2"><span><code class="def-type"><var class="var">hui</var> =</code> <strong class="def-name">uitoggletool</strong> <code class="def-code-arguments">(<var class="var">parent</var>)</code><a class="copiable-link" href="#index-uitoggletool-2"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-uitoggletool-3"><span><code class="def-type"><var class="var">hui</var> =</code> <strong class="def-name">uitoggletool</strong> <code class="def-code-arguments">(<var class="var">parent</var>, <var class="var">property</var>, <var class="var">value</var>, &hellip;)</code><a class="copiable-link" href="#index-uitoggletool-3"> &para;</a></span></dt>
<dd>
<p>Create a uitoggletool object.
</p>
<p>uitoggletool are togglebuttons that appear on a figure toolbar.  The
button is created with a border that is shown when the user hovers over
the button.  An image can be set using the cdata property.
</p>
<p>If <var class="var">parent</var> is omitted then a uitoggletool for the current figure is
created.  If no figure is available, a new figure is created first.  If a
figure is available, but does not contain a uitoolbar, a uitoolbar will be
created.
</p>
<p>If <var class="var">parent</var> is given then a uitoggletool is created on the
<var class="var">parent</var> uitoolbar.
</p>
<p>Any provided property value pairs will override the default values of the
created uitoggletool object.
</p>
<p>The full list of properties is documented at <a class="ref" href="Uitoggletool-Properties.html">Uitoggletool Properties</a>.
</p>
<p>The optional return value <var class="var">hui</var> is a graphics handle to the created
uitoggletool object.
</p>
<p>Examples:
</p>
<div class="example">
<div class="group"><pre class="example-preformatted">% create figure without a default toolbar
f = figure (&quot;toolbar&quot;, &quot;none&quot;);
% create empty toolbar
t = uitoolbar (f);
% create a 19x19x3 black square
img=zeros(19,19,3);
% add uitoggletool button to toolbar
b = uitoggletool (t, &quot;cdata&quot;, img);
</pre></div></div>

<p><strong class="strong">See also:</strong> <a class="ref" href="Multiple-Plot-Windows.html#XREFfigure">figure</a>, <a class="ref" href="#XREFuitoolbar">uitoolbar</a>, <a class="ref" href="#XREFuipushtool">uipushtool</a>.
</p></dd></dl>


</div>
<hr>
<div class="nav-panel">
<p>
Next: <a href="GUI-Utility-Functions.html">GUI Utility Functions</a>, Previous: <a href="Progress-Bar.html">Progress Bar</a>, Up: <a href="GUI-Development.html">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>