Define listener object for property events


lh = event.proplistener(Hobj,Properties,'PropEvent',@CallbackFunction)


lh = event.proplistener(Hobj,Properties,'PropEvent',@CallbackFunction) creates a property listener object for one or more properties on the specified object.

  • Hobj — handle of object whose property or properties are to be listened to. If Hobj is an array, the listener responds to the named event on all objects in the array.

  • Properties — an object array or a cell array of object handles representing the properties to which you want to listen.

  • PropEvent — must be one of the strings: PreSet, PostSet, PreGet, PostGet

  • @CallbackFunction — function handle to the callback function that executes when the event occurs.

The event.proplistener class defines property event listener objects. It is a subclass of the event.listener class and adds one property to those defined by event.listener:

  • Object — Cell array of objects whose property events are being listened to.

You can call the event.proplistener constructor instead of calling addlistener to create a property listener. However, when you do not use addlistener, the listener's lifecycle is not tied to the object(s) being listened to.

See Listen for Changes to Property Values.

See Getting Information About Properties for more information on using objects.

Was this topic helpful?