event.EventData - Base class for event data - MATLAB (original) (raw)

Main Content

Namespace: event
Superclasses: handle

Base class for event data

Description

The event.EventData class is the base class for all data objects passed to listeners. When you trigger an event using the notify handle class method, MATLAB® assigns values to the properties of an event.EventData object and passes that object to the listener callback function (the event handler).

To provide additional information to event listeners, subclassevent.EventData. For more information on custom event data, seeDefine Event-Specific Data.

Note

Subclasses of event.EventData must set the classConstructOnLoad attribute to true.

The event.EventData class is a handle class.

Class Attributes

ConstructOnLoad true
HandleCompatible true

For information on class attributes, see Class Attributes.

Creation

The notify handle class method creates anevent.EventData object when called to trigger an event. Theevent.EventData constructor accepts no input arguments so subclasses of event.EventData cannot pass arguments to the superclass constructor.

Properties

expand all

Source — Event source

object

Event source object, specified as a handle to the object that triggered the event.

Attributes:

GetAccess public
SetAccess private
GetObservable true
SetObservable true

EventName — Name of event

character vector

Name of the event, specified as a character vector.

Attributes:

GetAccess public
SetAccess private
GetObservable true
SetObservable true

Data Types: char

Examples

collapse all

Access Event Data

Get the event source object handle and the event name from the event.EventData object passed to this callback function when the event is triggered.

function myCallbk(s,evtData) eventSource = evtData.Source; eventName = evtData.EventName; ... end

Version History

Introduced in R2008a