function aObj = doclick(aObj)
%SCRIBEHGOBJ/DOCLICK

%   Copyright (c) 1984-98 by The MathWorks, Inc.
%   $Revision: 1.7 $  $Date: 1998/06/17 23:43:19 $

figH = get(aObj,'Figure');
figObjH = getobj(figH);

selType = get(figH,'SelectionType');

switch selType
case 'open'
   aObj = editopen(aObj);
otherwise
   aObj = doselect(aObj, selType, figObjH,'down');
   myH = get(aObj,'MyHandle');
   setappdata(figH,'ScribeCurrentObject', myH);
   if get(aObj,'IsSelected') & get(aObj,'Draggable')
      aObj = dragconstrained(aObj, selType, figH);
   else
      myHG = get(myH,'MyHGHandle');
      ud = getappdata(myHG,'ScribeObjectData');
      % write current changes
      ud.ObjectStore = aObj;
      setappdata(myHG,'ScribeObjectData',ud);
      set(figH,'WindowButtonUpFcn','prepdrag');
   end
end

