function figObj = doclick(figObj)
%FIGOBJ/DOCLICK

%   Copyright 1984-2000 The MathWorks, Inc. 
%   $Revision: 1.11 $  $Date: 2000/06/15 22:42:52 $

%Note that figure multi-select is still broken.   If we select
%any other objects after figure, they edit based on getting the
%figure "Selected" list.  The figure does not appear in its own
%"Selected" list, so it will no be edited.

%Note also that everything is pretty hosed for multiple figures.

myHG = get(figObj, 'MyHGHandle');

selType = get(myHG,'SelectionType');

if strcmp(selType,'extend') | strcmp(selType,'open')
    selection = get(figObj,'Selection');
    if ~isempty(selection)
        hList = subsref(selection,substruct('.','HGHandle'));
        if iscell(hList)
            hList=[myHG,hList{:}];
        else
            hList=[myHG,hList];
        end
    else
        hList=myHG;
    end
else
    dragBin = figObj.DragObjects;
    for aObjH = dragBin.Items;
        set(aObjH,'IsSelected',0);
    end
    hList=[myHG];
end

switch selType
case 'open'
    propedit(hList,'-noselect');
otherwise
    propedit(hList,'-noopen','-noselect');
end

