events

Lists the events defined by a class.

Category: Programming > Classes

Syntax

events(obj)

Prints the names of the events of the object's class.

events('ClassName')

Same, for a class given by name.

e = events(obj)

Returns the event names as a cell array.

Description

The list includes events inherited from superclasses. Every handle class has ObjectBeingDestroyed. The names are the ones that can be passed to addlistener, listener and notify.

Inside a classdef file, events is also the keyword that opens the block where a class declares its events.

Input arguments

obj
An object of a class that defines events.
'ClassName'
Name of a class.

Output arguments

e
Cell array of character vectors, one event name per row.

Example

Events of a handle object

m = containers.Map();
events(m)
e = events(m)
Output
Events for class containers.Map:

    ObjectBeingDestroyed

e = 1×1 cell

    {'ObjectBeingDestroyed'}

See also

addlistener listener event.hasListener notify