Mercurial > hg > octave-nkf
diff scripts/plot/allchild.m @ 17133:04c3d56e007a
allchild.m: Add input validation, %!test blocks, and more documentation.
* scripts/plot/allchild.m: Add input validation, %!test blocks, and more
documentation.
author | Rik <rik@octave.org> |
---|---|
date | Thu, 01 Aug 2013 08:17:24 -0700 |
parents | eaab03308c0b |
children | bc924baa2c4e |
line wrap: on
line diff
--- a/scripts/plot/allchild.m +++ b/scripts/plot/allchild.m @@ -20,11 +20,10 @@ ## @deftypefn {Function File} {@var{h} =} allchild (@var{handles}) ## Find all children, including hidden children, of a graphics object. ## -## This function is similar to @code{get (h, "children")}, but also -## returns hidden objects. If @var{handles} is a scalar, -## @var{h} will be a vector. Otherwise, @var{h} will be a cell matrix -## of the same size as @var{handles} and each cell will contain a -## vector of handles. +## This function is similar to @code{get (h, "children")}, but also returns +## hidden objects ("HandleVisibility" = "off"). If @var{handles} is a scalar, +## @var{h} will be a vector. Otherwise, @var{h} will be a cell matrix of the +## same size as @var{handles} and each cell will contain a vector of handles. ## @seealso{findall, findobj, get, set} ## @end deftypefn @@ -32,6 +31,10 @@ function h = allchild (handles) + if (nargin != 1) + print_usage (); + endif + shh = get (0, "showhiddenhandles"); unwind_protect set (0, "showhiddenhandles", "on"); @@ -48,9 +51,13 @@ %! hf = figure ("visible", "off"); %! unwind_protect %! l = line; -%! assert (get (allchild (hf),"type"),{"axes"; "uimenu"; "uimenu"; "uimenu"}); +%! kids = allchild (hf); +%! assert (get (kids, "type"), {"axes"; "uimenu"; "uimenu"; "uimenu"}); %! unwind_protect_cleanup %! close (hf); %! graphics_toolkit (toolkit); %! end_unwind_protect +%!error allchild () +%!error allchild (1, 2) +