Code covered by the BSD License  

Highlights from
showcontextmenu

image thumbnail
from showcontextmenu by Igor
Simple way to show contextmenu on left click in a nice drop-down way.

feval_onButtonDownExact(callback,hObject)
function feval_onButtonDownExact(callback,hObject)

assert(~iscell(hObject), 'possible varargin{:} bug');
hFigure = getParentFigure(hObject);
hObject_pos = getPositionOnFigure(hObject,'pixels');


selectiontype = get(hFigure,'selectiontype');
if strcmp( selectiontype , 'alt')   || strcmp( selectiontype , 'open')
    pos=getCurrentPoint(hFigure,'pixels');
    
    if all(  pos>=hObject_pos(1:2) & pos<=hObject_pos(3:4)+hObject_pos(1:2)  )
        
        feval(callback,hObject);
        
    end
end
end

Contact us