Contenido principal

iptGetPointerBehavior

Retrieve pointer behavior from graphics object or UI component

Description

pointerBehavior = iptGetPointerBehavior(obj) returns the pointer behavior structure associated with the graphics container obj. A pointer behavior structure controls what happens when the mouse pointer moves over and then exits the graphics container. A graphics container can be a graphics object or a UI component.

For the pointer to perform the desired pointer behavior, the parent figure of the graphics container obj must contain a pointer manager. For more information about creating a pointer manager for a figure, see iptPointerManager.

example

Examples

collapse all

Plot a line, then create a pointer manager in the parent figure of the line. Then, associate a pointer behavior structure with the line object in the figure that changes the mouse pointer into a fleur whenever the pointer is over it.

h = plot(1:10);
iptPointerManager(gcf);

Define a pointer behavior for the line object. When the pointer moves over the line object, change the mouse pointer into a fleur.

enterFcn = @(hFigure,currentPoint)set(hFigure,"Pointer","fleur");
iptSetPointerBehavior(h,enterFcn);

Get the pointer behavior of the line. The traverseFcn and exitFcn fields of the pointer behavior structure are empty because you did not specify behaviors for those actions.

iptGetPointerBehavior(h);
ans = 

  struct with fields:

       enterFcn: @(hFigure,currentPoint)set(hFigure,"Pointer","fleur")
    traverseFcn: []
        exitFcn: []

Input Arguments

collapse all

Graphics container, specified as a graphics object or a UI component. For example, obj can be a figure, axes, or image graphics object, or a uifigure or uipanel UI component.

Output Arguments

collapse all

Pointer behavior, returned as a structure with three fields.

FieldWhen Called
enterFcnCalled when the mouse pointer moves over the object.
traverseFcnCalled once when the mouse pointer moves over the object, and called again each time the mouse moves within the object.
exitFcnCalled when the mouse pointer leaves the object.

If obj does not contain a pointer behavior structure, then iptGetPointerBehavior returns [].

Version History

Introduced in R2006a