annotate scripts/gui/uibuttongroup.m @ 30875:5d3faba0342e

doc: Ensure documentation lists output argument when it exists for all m-files. For new users of Octave it is best to show explicit calling forms in the documentation and to show a return argument when it exists. * bp-table.cc, shift.m, accumarray.m, accumdim.m, bincoeff.m, bitcmp.m, bitget.m, bitset.m, blkdiag.m, celldisp.m, cplxpair.m, dblquad.m, flip.m, fliplr.m, flipud.m, idivide.m, int2str.m, interpft.m, logspace.m, num2str.m, polyarea.m, postpad.m, prepad.m, randi.m, repmat.m, rng.m, rot90.m, rotdim.m, structfun.m, triplequad.m, uibuttongroup.m, uicontrol.m, uipanel.m, uipushtool.m, uitoggletool.m, uitoolbar.m, waitforbuttonpress.m, help.m, __additional_help_message__.m, hsv.m, im2double.m, im2frame.m, javachk.m, usejava.m, argnames.m, char.m, formula.m, inline.m, __vectorize__.m, findstr.m, flipdim.m, strmatch.m, vectorize.m, commutation_matrix.m, cond.m, cross.m, duplication_matrix.m, expm.m, orth.m, rank.m, rref.m, trace.m, vech.m, cast.m, compare_versions.m, delete.m, dir.m, fileattrib.m, grabcode.m, gunzip.m, inputname.m, license.m, list_primes.m, ls.m, mexext.m, movefile.m, namelengthmax.m, nargoutchk.m, nthargout.m, substruct.m, swapbytes.m, ver.m, verLessThan.m, what.m, fminunc.m, fsolve.m, fzero.m, optimget.m, __fdjac__.m, matlabroot.m, savepath.m, campos.m, camroll.m, camtarget.m, camup.m, camva.m, camzoom.m, clabel.m, diffuse.m, legend.m, orient.m, rticks.m, specular.m, thetaticks.m, xlim.m, xtickangle.m, xticklabels.m, xticks.m, ylim.m, ytickangle.m, yticklabels.m, yticks.m, zlim.m, ztickangle.m, zticklabels.m, zticks.m, ellipsoid.m, isocolors.m, isonormals.m, stairs.m, surfnorm.m, __actual_axis_position__.m, __pltopt__.m, close.m, graphics_toolkit.m, pan.m, print.m, printd.m, __ghostscript__.m, __gnuplot_print__.m, __opengl_print__.m, rotate3d.m, subplot.m, zoom.m, compan.m, conv.m, poly.m, polyaffine.m, polyder.m, polyint.m, polyout.m, polyreduce.m, polyvalm.m, roots.m, prefdir.m, prefsfile.m, profexplore.m, profexport.m, profshow.m, powerset.m, unique.m, arch_rnd.m, arma_rnd.m, autoreg_matrix.m, bartlett.m, blackman.m, detrend.m, durbinlevinson.m, fftconv.m, fftfilt.m, fftshift.m, fractdiff.m, hamming.m, hanning.m, hurst.m, ifftshift.m, rectangle_lw.m, rectangle_sw.m, triangle_lw.m, sinc.m, sinetone.m, sinewave.m, spectral_adf.m, spectral_xdf.m, spencer.m, ilu.m, __sprand__.m, sprand.m, sprandn.m, sprandsym.m, treelayout.m, beta.m, betainc.m, betaincinv.m, betaln.m, cosint.m, expint.m, factorial.m, gammainc.m, gammaincinv.m, lcm.m, nthroot.m, perms.m, reallog.m, realpow.m, realsqrt.m, sinint.m, hadamard.m, hankel.m, hilb.m, invhilb.m, magic.m, pascal.m, rosser.m, toeplitz.m, vander.m, wilkinson.m, center.m, corr.m, cov.m, discrete_cdf.m, discrete_inv.m, discrete_pdf.m, discrete_rnd.m, empirical_cdf.m, empirical_inv.m, empirical_pdf.m, empirical_rnd.m, kendall.m, kurtosis.m, mad.m, mean.m, meansq.m, median.m, mode.m, moment.m, range.m, ranks.m, run_count.m, skewness.m, spearman.m, statistics.m, std.m, base2dec.m, bin2dec.m, blanks.m, cstrcat.m, deblank.m, dec2base.m, dec2bin.m, dec2hex.m, hex2dec.m, index.m, regexptranslate.m, rindex.m, strcat.m, strjust.m, strtrim.m, strtrunc.m, substr.m, untabify.m, __have_feature__.m, __prog_output_assert__.m, __run_test_suite__.m, example.m, fail.m, asctime.m, calendar.m, ctime.m, date.m, etime.m: Add return arguments to @deftypefn macros where they were missing. Rename variables in functions (particularly generic "retval") to match documentation. Rename some return variables for (hopefully) better clarity (e.g., 'ax' to 'hax' to indicate it is a graphics handle to an axes object).
author Rik <rik@octave.org>
date Wed, 30 Mar 2022 20:40:27 -0700
parents 796f54d4ddbf
children 597f3ee61a48
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 ##
30564
796f54d4ddbf update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
3 ## Copyright (C) 2016-2022 The Octave Project Developers
27918
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 27730
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/>.
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
7 ##
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
8 ## This file is part of Octave.
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
9 ##
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24478
diff changeset
10 ## Octave is free software: you can redistribute it and/or modify it
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
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: 24478
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: 21824
diff changeset
13 ## (at your option) any later version.
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
14 ##
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
15 ## Octave is distributed in the hope that it will be useful, but
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 21824
diff changeset
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 21824
diff changeset
18 ## GNU General Public License for more details.
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
19 ##
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
20 ## You should have received a copy of the GNU General Public License
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
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: 24478
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 ########################################################################
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
25
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
26 ## -*- texinfo -*-
30875
5d3faba0342e doc: Ensure documentation lists output argument when it exists for all m-files.
Rik <rik@octave.org>
parents: 30564
diff changeset
27 ## @deftypefn {} {@var{hui} =} uibuttongroup ()
5d3faba0342e doc: Ensure documentation lists output argument when it exists for all m-files.
Rik <rik@octave.org>
parents: 30564
diff changeset
28 ## @deftypefnx {} {@var{hui} =} uibuttongroup (@var{property}, @var{value}, @dots{})
5d3faba0342e doc: Ensure documentation lists output argument when it exists for all m-files.
Rik <rik@octave.org>
parents: 30564
diff changeset
29 ## @deftypefnx {} {@var{hui} =} uibuttongroup (@var{parent})
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
30 ## @deftypefnx {} {@var{hui} =} uibuttongroup (@var{parent}, @var{property}, @var{value}, @dots{})
30875
5d3faba0342e doc: Ensure documentation lists output argument when it exists for all m-files.
Rik <rik@octave.org>
parents: 30564
diff changeset
31 ## @c FIXME: 3rd form is not documented by Matlab nor implemented in Octave.
5d3faba0342e doc: Ensure documentation lists output argument when it exists for all m-files.
Rik <rik@octave.org>
parents: 30564
diff changeset
32 ## @c Should it be removed? (1/9/2022).
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
33 ## @deftypefnx {} {} uibuttongroup (@var{h})
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
34 ##
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
35 ## Create a uibuttongroup object and return a handle to it.
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
36 ##
25298
5ca8abb27644 Only emit a warning, not error, when uiXXX.m are called for focusing (bug #53710).
Rik <rik@octave.org>
parents: 25054
diff changeset
37 ## A uibuttongroup is used to group uicontrol objects.
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
38 ##
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
39 ## If @var{parent} is omitted then a uibuttongroup for the current figure is
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
40 ## created. If no figure is available, a new figure is created first.
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
41 ##
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
42 ## If @var{parent} is given then a uibuttongroup relative to @var{parent} is
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
43 ## created.
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
44 ##
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
45 ## Any provided property value pairs will override the default values of the
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
46 ## created uibuttongroup object.
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
47 ##
26877
83774c2a1b92 doc: Place cross-reference from list of graphics object properties back to object (bug #46076).
Rik <rik@octave.org>
parents: 26376
diff changeset
48 ## The full list of properties is documented at @ref{Uibuttongroup Properties}.
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
49 ##
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
50 ## Examples:
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
51 ##
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
52 ## @example
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
53 ## @group
25298
5ca8abb27644 Only emit a warning, not error, when uiXXX.m are called for focusing (bug #53710).
Rik <rik@octave.org>
parents: 25054
diff changeset
54 ## ## Create figure and panel on it
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
55 ## f = figure;
25298
5ca8abb27644 Only emit a warning, not error, when uiXXX.m are called for focusing (bug #53710).
Rik <rik@octave.org>
parents: 25054
diff changeset
56 ## ## Create a button group
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
57 ## gp = uibuttongroup (f, "Position", [ 0 0.5 1 1])
25298
5ca8abb27644 Only emit a warning, not error, when uiXXX.m are called for focusing (bug #53710).
Rik <rik@octave.org>
parents: 25054
diff changeset
58 ## ## Create a buttons in the group
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
59 ## b1 = uicontrol (gp, "style", "radiobutton", ...
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
60 ## "string", "Choice 1", ...
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
61 ## "Position", [ 10 150 100 50 ]);
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
62 ## b2 = uicontrol (gp, "style", "radiobutton", ...
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
63 ## "string", "Choice 2", ...
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
64 ## "Position", [ 10 50 100 30 ]);
25298
5ca8abb27644 Only emit a warning, not error, when uiXXX.m are called for focusing (bug #53710).
Rik <rik@octave.org>
parents: 25054
diff changeset
65 ## ## Create a button not in the group
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
66 ## b3 = uicontrol (f, "style", "radiobutton", ...
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
67 ## "string", "Not in the group", ...
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
68 ## "Position", [ 10 50 100 50 ]);
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
69 ## @end group
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
70 ## @end example
25298
5ca8abb27644 Only emit a warning, not error, when uiXXX.m are called for focusing (bug #53710).
Rik <rik@octave.org>
parents: 25054
diff changeset
71 ##
5ca8abb27644 Only emit a warning, not error, when uiXXX.m are called for focusing (bug #53710).
Rik <rik@octave.org>
parents: 25054
diff changeset
72 ## When called with a single argument @var{h} which is a handle to an existing
5ca8abb27644 Only emit a warning, not error, when uiXXX.m are called for focusing (bug #53710).
Rik <rik@octave.org>
parents: 25054
diff changeset
73 ## uibuttongroup object, switch the focus to the specified uibuttongroup. This
5ca8abb27644 Only emit a warning, not error, when uiXXX.m are called for focusing (bug #53710).
Rik <rik@octave.org>
parents: 25054
diff changeset
74 ## functionality is not currently implemented.
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
75 ## @seealso{figure, uipanel}
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
76 ## @end deftypefn
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
77
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
78 function hui = uibuttongroup (varargin)
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
79
24478
59041be1994b Use new function isgraphics to simplify m-files.
Rik <rik@octave.org>
parents: 24423
diff changeset
80 if (nargin == 1 && isgraphics (varargin{1}, "uibuttongroup"))
25298
5ca8abb27644 Only emit a warning, not error, when uiXXX.m are called for focusing (bug #53710).
Rik <rik@octave.org>
parents: 25054
diff changeset
81 warning ("uibuttongroup: focusing not implemented yet");
5ca8abb27644 Only emit a warning, not error, when uiXXX.m are called for focusing (bug #53710).
Rik <rik@octave.org>
parents: 25054
diff changeset
82 return;
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
83 endif
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
84
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
85 [h, args] = __uiobject_split_args__ ("uibuttongroup", varargin,
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
86 {"figure", "uipanel", "uibuttongroup"});
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
87 hui = __go_uibuttongroup__ (h, args{:});
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
88
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
89 endfunction
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
90
25298
5ca8abb27644 Only emit a warning, not error, when uiXXX.m are called for focusing (bug #53710).
Rik <rik@octave.org>
parents: 25054
diff changeset
91
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
92 %!demo
27730
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
93 %! f = clf ();
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
94 %! gp = uibuttongroup (f, "position", [0 0.5 1 0.5], ...
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
95 %! "selectionchangedfcn", ...
27730
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
96 %! @(h, e) fprintf ("Selection changed: %s\n", get (e.NewValue, "string")));
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
97 %! b1 = uicontrol (gp, "style", "radiobutton", ...
27730
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
98 %! "string", "Choice 1", ...
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
99 %! "units", "normalized", ...
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
100 %! "position", [0.01 0.5 0.98 0.5]);
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
101 %! b2 = uicontrol (gp, "style", "radiobutton", ...
27730
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
102 %! "string", "Choice 2", ...
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
103 %! "units", "normalized", ...
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
104 %! "position", [0.01 0 0.98 0.5]);
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
105 %! b3 = uicontrol (f, "style", "radiobutton", ...
27730
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
106 %! "string", "Not in the group", ...
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
107 %! "units", "normalized", ...
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
108 %! "position", [ 0.01 0 0.98 0.5 ]);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
109 %! fprintf ("Current selected: %s\n", get (get (gp, "selectedobject"), "string"));
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
110 %! pause (0.5);
27730
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
111 %! disp ("Select b2");
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
112 %! set (gp, "selectedobject", b2);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
113 %! fprintf ("Current selected: %s\n", get (get (gp, "selectedobject"), "string"));
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
114 %! pause (0.5);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
115 %! disp ("Select None");
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
116 %! set (gp, "selectedobject", []);
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
117 %! pause (0.1);
27730
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
118 %! fprintf ("Current selected: %s\n", get (get (gp, "selectedobject"), "string"));
21824
6780a8657be3 Implement uibuttongroup (bug #47513)
Andrew Thornton <art27@cantab.net>
parents:
diff changeset
119
27730
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
120 ## Test mutual selection logic for radiobuttons
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
121 ## FIXME: commented out until a test can be found that doesn't rely on
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
122 ## long values for pause() which still can occasionally fail.
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
123 %!#test <*55230>
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
124 %! hf = figure ("visible", "off");
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
125 %! unwind_protect
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
126 %! bg = uibuttongroup (hf);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
127 %! b1 = uicontrol (bg, "style", "radiobutton", "units", "normalized", ...
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
128 %! "position", [0, 0, 1, 0.5]);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
129 %! b2 = uicontrol (bg, "style", "radiobutton", "units", "normalized", ...
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
130 %! "position", [0, 0.5, 1, 0.5]);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
131 %! assert (get (bg, "selectedobject"), b1);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
132 %! assert (get (b1, "value"), 1);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
133 %! assert (get (b2, "value"), 0);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
134 %! ## select radiobutton 2
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
135 %! set (bg, "selectedobject", b2);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
136 %! pause (0.5);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
137 %! assert (get (b1, "value"), 0);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
138 %! assert (get (b2, "value"), 1);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
139 %! ## set radiobutton 1
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
140 %! set (b1, "value", 1);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
141 %! pause (0.5);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
142 %! assert (get (bg, "selectedobject"), b1);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
143 %! assert (get (b1, "value"), 1);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
144 %! assert (get (b2, "value"), 0);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
145 %! ## unset all radiobuttons
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
146 %! set (bg, "selectedobject", []);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
147 %! pause (0.5);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
148 %! assert (get (b1, "value"), 0);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
149 %! assert (get (b2, "value"), 0);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
150 %! ## change style of selected button
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
151 %! set (b1, "value", 1);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
152 %! pause (0.5);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
153 %! assert (get (bg, "selectedobject"), b1);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
154 %! set (b1, "style", "pushbutton");
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
155 %! pause (0.5);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
156 %! assert (get (bg, "selectedobject"), []);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
157 %! ## add new button
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
158 %! b3 = uicontrol (bg, "style", "togglebutton");
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
159 %! pause (0.5);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
160 %! assert (get (bg, "selectedobject"), b3);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
161 %! assert (get (b2, "value"), 0);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
162 %! assert (get (b3, "value"), 1);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
163 %! ## remove selected button
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
164 %! delete (b3);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
165 %! pause (0.5);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
166 %! assert (get (bg, "selectedobject"), []);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
167 %! unwind_protect_cleanup
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
168 %! close (hf);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
169 %! end_unwind_protect
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
170
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
171 ## Test mutual selection logic for togglebuttons
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
172 ## FIXME: commented out until a test can be found that doesn't rely on
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
173 ## long values for pause() which still can occasionally fail.
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
174 %!#test <*55230>
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
175 %! hf = figure ("visible", "off");
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
176 %! unwind_protect
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
177 %! bg = uibuttongroup (hf);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
178 %! b1 = uicontrol (bg, "style", "togglebutton", "units", "normalized", ...
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
179 %! "position", [0, 0, 1, 0.5]);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
180 %! b2 = uicontrol (bg, "style", "togglebutton", "units", "normalized", ...
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
181 %! "position", [0, 0.5, 1, 0.5]);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
182 %! assert (get (bg, "selectedobject"), b1);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
183 %! assert (get (b1, "value"), 1);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
184 %! assert (get (b2, "value"), 0);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
185 %! ## select togglebutton 2
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
186 %! set (bg, "selectedobject", b2);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
187 %! pause (0.5);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
188 %! assert (get (b1, "value"), 0);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
189 %! assert (get (b2, "value"), 1);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
190 %! ## set togglebutton 1
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
191 %! set (b1, "value", 1);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
192 %! pause (0.5);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
193 %! assert (get (bg, "selectedobject"), b1);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
194 %! assert (get (b1, "value"), 1);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
195 %! assert (get (b2, "value"), 0);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
196 %! ## unset all togglebuttons
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
197 %! set (bg, "selectedobject", []);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
198 %! pause (0.5);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
199 %! assert (get (b1, "value"), 0);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
200 %! assert (get (b2, "value"), 0);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
201 %! ## change style of selected button
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
202 %! set (b1, "value", 1);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
203 %! pause (0.5);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
204 %! assert (get (bg, "selectedobject"), b1);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
205 %! set (b1, "style", "pushbutton");
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
206 %! assert (get (bg, "selectedobject"), []);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
207 %! ## add new button
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
208 %! b3 = uicontrol (bg, "style", "togglebutton");
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
209 %! pause (0.5);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
210 %! assert (get (bg, "selectedobject"), b3);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
211 %! assert (get (b2, "value"), 0);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
212 %! assert (get (b3, "value"), 1);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
213 %! ## remove selected button
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
214 %! delete (b3);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
215 %! pause (0.5);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
216 %! assert (get (bg, "selectedobject"), []);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
217 %! unwind_protect_cleanup
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
218 %! close (hf);
5b9067c17e4b Keep track of children in uibuttongroup (bug #55230).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26877
diff changeset
219 %! end_unwind_protect