|
In article <fno7h9$3mb$1@fred.mathworks.com>,
Mohammad salehizadeh <en66salehi.mohammad@example.com> wrote:
>I want to know what is function of hittest and setptr in
>the following instruction?
>%%%%%%%%%%%%%%
>% localHover %
>%%%%%%%%%%%%%%
>function localHover(eventSrc,eventData)
> %---WindowButtonMotionFcn
> obj = hittest(eventSrc);
> switch lower(get(obj,'tag'))
> case 'slider'
> setptr(eventSrc,'hand');
> otherwise
> setptr(eventSrc,'arrow');
> end
Both hittest() and setptr() appear to be local functions,
or perhaps defined in some Matlab toolbox that I do not have.
My deduction for setptr would be:
function setptr(eventSrc,shape)
set(eventSrc, 'Pointer', shape)
end
That is, set the figure pointer to be the given shape.
hittest:
The source event that you get for the localHover function is the
figure, not an individual object. I believe hittest() applied to the
figure must somehow determine which object within the figure is
being pointed to, and returns the handle of that object.
But checking the tag of an object against the string 'slider' would
not be the most robust way to detect a uicontrol of type slider,
as tags can be defined by the user. *Possibly* the object returned
is even lower level than uicontrol(), if the localHover() function
is intended to switch to the hand pointer only when you are pointing
to some sub-parts of a slider uicontrol.
--
This is a Usenet signature block. Please do not quote it when replying
to one of my postings.
http://en.wikipedia.org/wiki/Signature_block
|