listener on graphics property 'BeingDeleted'

2 visualizzazioni (ultimi 30 giorni)
Markus Leuthold
Markus Leuthold il 6 Nov 2015
Risposto: Sean de Wolski il 1 Set 2016
How do I add a listener to a graphics object being deleted? It seems like 'BeingDeleted' is set to 'on' during deletion. Furthermore 'BeingDeleted' is SetObservable. So why does the following code not work?
h=plot(0,0,'.b');
addlistener(h,'BeingDeleted','PostSet',@(varargin)(disp('deleted')))
delete(h)
Please note I don't want to use the callback 'deleteFcn', since there might be other objects interested in the delete event.
  1 Commento
Daniel Kovari
Daniel Kovari il 1 Set 2016
I'm also having trouble with listeners to 'BeingDeleted'. Did you find a work around?

Accedi per commentare.

Risposte (1)

Sean de Wolski
Sean de Wolski il 1 Set 2016
How about just listening for 'ObjectBeingDestroyed'?
addlistener(h,'ObjectBeingDestroyed',@(varargin)(disp('deleted')))

Categorie

Scopri di più su Interactive Control and Callbacks in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by