File Exchange

image thumbnail

PropListener - add a callback to property value get/set event

version (1.96 KB) by Yair Altman
Attach a listener callback to a property value get/set event(s)


Updated 14 Jan 2008

No License

This is an enhancement of Matlab's hidden and unsupported addlistener function (within the uitools folder). It attaches a listener callback to one or more property (or properties) get or set event(s).

Acceptable events are PreGet, PreSet, PostGet and PostSet, which are triggered immediately before/after a get/set event on a handle property value.


See more extensive help section within.

Note: relies on undocumented and unsupported Matlab functionality. Use at your own risk. Comments welcome

Cite As

Yair Altman (2020). PropListener - add a callback to property value get/set event (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (4)


Very nice function!
But broken since R2014b:
>> proplistener(gcf,{'Visible','NumberTitle'},{'PreGet','postSet'},@myFunc)
No constructor 'handle.listener' with matching signature found.
Error in proplistener>attachListener (line 106)
hl = handle.listener(hContainer, hSrc, eventName, callback);
Error in proplistener (line 77)
hTemp = attachListener(hContainer, hSrc, eventName{i}, callback);
(Same command works in R2014a)

Any chance to fix it?


Once again Yair saves a lot of frustration with his instructive and well written code. Until I get R2008 up this function nicely does the trick.

In my case coordinating the 'EdgeColo'r of a patch and a line's 'Color' property. Something linkprop can't do.

A. Price

I was able to use this function to update a graph every time the x-axis changed, without knowing much about how listeners work.

MATLAB Release Compatibility
Created with R2007a
Compatible with any release
Platform Compatibility
Windows macOS Linux