# HG changeset patch # User Rik # Date 1375370244 25200 # Node ID 04c3d56e007abf9642934c546043a1e33b1b2509 # Parent f72ffae1fcc3402b63d1d8c7d68a6f9c9273bdc1 allchild.m: Add input validation, %!test blocks, and more documentation. * scripts/plot/allchild.m: Add input validation, %!test blocks, and more documentation. diff -r f72ffae1fcc3 -r 04c3d56e007a scripts/plot/allchild.m --- a/scripts/plot/allchild.m Thu Aug 01 15:16:14 2013 +0200 +++ b/scripts/plot/allchild.m Thu Aug 01 08:17:24 2013 -0700 @@ -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) +