Documentation of idmhit


Global Index (short | long) | Local contents | Local Index (short | long)


Function Synopsis

h = idmhit(objtype)

Help text

IDMHIT Determines whether figure is over an object of a certain type.
   If the pointer is over an object of type objtype, return the handle
   to that object, else 0. If we're not over a figure, return empty.

Cross-Reference Information

This function is called by

Listing of function idmhit

function h = idmhit(objtype)

%   L. Ljung 9-27-94, Adopted from Joe
%   Copyright (c) 1986-98 by The MathWorks, Inc.
%   $Revision: 2.3 $  $Date: 1997/12/02 03:41:41 $

f = get(0,'pointerwindow');
if(f == 0)
        h = [];
        return;
end

p = get(0,'pointerloc');
set(f,'units','pixels');
pos = get(f,'pos');
x = (p(1)-pos(1))/pos(3);
y = (p(2)-pos(2))/pos(4);
c = findobj(get(f,'children'),'type',objtype,'vis','on');
set(c,'units','norm');
for h = c'
        r = get(h,'pos');
        if((x > r(1)) & (x < (r(1) + r(3))) &...
           (y > r(2)) & (y < (r(2) + r(4))))
                return;
        end
end
h = [];