Return handle of current object
Syntax
h = gco
h = gco(figure_handle)
Description
h = gco
returns the handle of the current object.
h = gco(figure_handle)
returns the value of the current object for the Figure specified by figure_handle
.
Remarks
The current object is the last object clicked on, excluding Uimenus. If the mouse click did not occur over a Figure child object, the Figure becomes the current object. MATLAB stores the handle of the current object in the Figure's CurrentObject
property.
The CurrentObject
of the CurrentFigure
does not always indicate the object whose callback is being executed. Interruptions of callbacks by other callbacks can change the CurrentObject
or even the CurrentFigure
. Some callbacks, such as CreateFcn and DeleteFcn, and Uimenu Callback intentionally do not update CurrentFigure or CurrentObject.
gcbo provides the only completely reliable way to retrieve the handle to the object whose callback is executing, at any point in the callback function, regardless of the type of callback or of any previous interruptions.
Examples
This statement returns the handle to the current object in Figure window 2:
h = gco(2)
See Also
gca
, gcbo
, gcf
The Root
object description
[ Previous | Help Desk | Next ]