Hi all,
I’ve created a ChartContainer in MATLAB R2024b and need to track when its update routine finishes so I can restore an internal property to its original value. During setup, I added listeners for the PreUpdate and PostUpdate events of the ChartContainer.
However, when I change a property, the update method runs, but neither the PreUpdate nor PostUpdate events seem to fire.
Below I share the class implementation:
classdef TestComponent < matlab.graphics.chartcontainer.ChartContainer
TriggerUpdate (1,1) logical = false;
properties (Transient, NonCopyable, Hidden, SetAccess = protected, UsedInUpdate = false)
EventListeners (1,:) event.listener
methods (Access = protected)
metaClass = meta.class.fromName(class(obj));
eventList = {metaClass.EventList.Name};
listenAcces = {metaClass.EventList.ListenAccess};
for idx = 1:numel(eventList)
if ~strcmpi(listenAcces{idx}, {'public', 'protected'})
obj.EventListeners(end+1) = listener(obj, ...
eventList{idx}, @(s,e) obj.showEvent(e));
function showEvent(obj, e)
Does anyone know why these events aren’t triggered? For ComponentContainer, the events work as expected.