listener on graphics property 'BeingDeleted'

조회 수: 2 (최근 30일)
Markus Leuthold
Markus Leuthold 2015년 11월 6일
답변: Sean de Wolski 2016년 9월 1일
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
Daniel Kovari
Daniel Kovari 2016년 9월 1일
I'm also having trouble with listeners to 'BeingDeleted'. Did you find a work around?

댓글을 달려면 로그인하십시오.

답변 (1개)

Sean de Wolski
Sean de Wolski 2016년 9월 1일
How about just listening for 'ObjectBeingDestroyed'?
addlistener(h,'ObjectBeingDestroyed',@(varargin)(disp('deleted')))

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by