gcbf

Returns the figure that contains the object whose callback is running.

Category: Graphics > Graphics Objects

Syntax

fig = gcbf

Returns the callback figure, or an empty object when no callback is running.

Description

Inside a callback of a UI control or graphics object, gcbf identifies the figure that holds it, which is not necessarily the current figure. It is the figure that owns the object returned by gcbo. Outside any callback it returns an empty GraphicsPlaceholder.

Output arguments

fig
Handle of the figure, or an empty placeholder.

Example

Outside a callback

f = gcbf;
disp(class(f))
Output
matlab.graphics.GraphicsPlaceholder

See also

gcbo gcf gco ancestor