Hello, I am building a simple GUI program and dealing with Mouse Move on this way:
function onMouseMove(this,~,~)
if ~isempty(this.m_hnd)
delete(this.m_hnd)
this.m_hnd = gobjects(0);
end
for i=1:app.PillarsStatsPanel.Children.GridSize(1)
this.m_hnd(i) = hggroup(app.PillarsStatsPanel.Children.Children(i));
h1 = text(app.PillarsStatsPanel.Children.Children(i),this.GetX(),this.GetY(),this.GetText(),'Parent',this.m_hnd(i));
...
end
end
But infrequently, this error appears:
Error using text
Cannot set property to a deleted object.
Error in ChartXYToolbar/onMouseMove (line 204)
h1 = text(app.PillarsStatsPanel.Children.Children(i),this.GetX(),this.GetY(),this.GetText(),'Parent',this.m_hnd(i));
Error in ChartXYToolbar>@(varargin)this.onMouseMove(varargin{:}) (line 47)
set(app.BAICAUIFigure,'windowbuttonmotionfcn',@this.onMouseMove);
Error while evaluating Figure WindowButtonMotionFcn.
I have no idea what is causing this error, any thoughts?