gco - Handle of current object - MATLAB (original) (raw)

Main Content

Syntax

h = gco h = gco(figure_handle)

Description

h = gco returns the handle of the current object.

h = gco(figure_handle) returns the handle of the current object in the figure specified by figure_handle.

Tips

The current object is the last object clicked or selected via keyboard interaction, excludinguimenus. If the mouse click did not occur over a figure child object, the figure becomes the current object. The MATLABĀ® software stores the handle of the current object in the figure'sCurrentObject property.

An object can become the current object as a result of pressing the space bar to invoke a callback in a dialog when a uicontrol in that dialog has focus (usually the result of using the Tab key to change focus).

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 theCurrentFigure. Some callbacks, such asCreateFcn and DeleteFcn, and uimenuCallback, intentionally do not updateCurrentFigure or CurrentObject.

gcbo provides the only completely reliable way to retrieve the handle to the object whose callback is executing, at any point in thecallback function, regardless of the type of callback or of any previous interruptions.

Version History

Introduced before R2006a