No BSD License  

5.0
5.0 | 3 ratings Rate this file 6 Downloads (last 30 days) File Size: 5.59 KB File ID: #18301 Version: 1.0

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

by

Yair Altman (view profile)

 

12 Jan 2008 (Updated )

Attach a listener callback to a property value get/set event(s)

| Watch this File

File Information
Description

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.

Example:
proplistener(gcf,{'Visible','NumberTitle'},{'PreGet','postSet'},@myFunc)

See more extensive help section within.

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

Acknowledgements

This file inspired Gridcolor, Changeloglabels V3, and Ui Split Pane Split A Container (Figure/Frame/Uipanel) Into Two Resizable Sub Containers.

MATLAB release MATLAB 7.4 (R2007a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (4)
15 Feb 2015 Igor

Igor (view profile)

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?

Comment only
03 Nov 2012 Cristiano  
20 Nov 2008 Matthew Whitaker

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.

16 Jan 2008 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.

Contact us