function [out] = uigettool(fig,id)
% This undocumented function may change in a future release.

% C = UIGETTOOL(H,'GroupName.ComponentName')
%     H is a vector of toolbar handles or a figure handle
%     'GroupName' is the name of the toolbar group
%     'ComponentName' is the name of the toolbar component
%     C is a toolbar component
%
% See also UITOOLFACTORY

%   Copyright 1984-2003 The MathWorks, Inc.
%   $Revision: 1.1.6.3 $ $Date: 2004/11/29 23:33:34 $

% Note: All code here must have fast performance
% since this function will be used in callbacks.
if ~all(ishandle(fig))
  error('MATLAB:uigettool:InvalidHandle','Invalid handle.');
end
if length(fig) == 1 && isa(handle(fig),'hg.figure')
  fig = findobj(allchild(fig),'flat','Type','uitoolbar');
end
out = findall(fig,'Tag',id);
