addlistener() question

Ben Abbott bpabbott at mac.com
Wed Dec 31 17:45:52 CST 2008


I've been experimenting with addlistener() with the intent of adding  
listeners for particular aspects of the graphics backend(s).

> addlistener (H, PROP, FCN)
> PROP must be a string naming a valid property of the graphics object  
> handle, H.
> FCN can be a function handle, a string or a cell array whose first  
> element is a function handle.

So my question is; Does anyone have a thought of how to listen for a  
change to "units" and have the call back function modify the value(s)  
associated with the units? For example, consider the Matlab commands  
below

 >> figure(1)
 >> get (gcf, 'position')

ans =  440   314   560   420

 >> set (gcf, 'units', 'inches')
 >> get (gcf, 'position')

ans =  5.8572       4.1761       7.4716       5.6037

To implement this action in Octave, both the "units" setting prior to  
and after the "set" command must be known. Might there be a creative  
way to pass the units setting prior to the "set" command to the  
callback?

Something sloppy could be done to save the old units value as a  
property of the figure, but it would be modifiable at the users  
discretion.

Ben


More information about the Octave-maintainers mailing list