function object = iduigco(figure)
%IDUIGCO    Handle of current object.
%   OBJECT = GCO returns the current object in
%   the current figure.
%
%   OBJECT = GCO(FIGURE) returns the current object
%   in figure FIGURE.
%
%   The current object for a given figure is the last
%   object clicked on with the mouse.


%   Copyright 1986-2000 The MathWorks, Inc.
%   $Revision: 1.4 $  $Date: 2000/06/15 11:46:27 $

if isempty (get (0, 'Children')),
   object = [];
   return;
end;

if(nargin == 0)
   figure = get(0,'CurrentFigure');
end

object = get( figure, 'CurrentObject');