Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Listen to PostUpdate instead of PostSet event #73

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions widgets/+wt/+mixin/BackgroundColorable.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
% List of graphics controls to apply to
BackgroundColorableComponents (:,1) matlab.graphics.Graphics

% Listener to background color changes
BackgroundColorListener event.proplistener
% Listener to update method
UpdateListener event.listener

end %properties

Expand Down Expand Up @@ -47,10 +47,12 @@ function updateBackgroundColorableComponents(obj)

function listenForBackgroundChange(obj)

% Establish Listener for Background Color Change
if isempty(obj.BackgroundColorListener)
obj.BackgroundColorListener = ...
addlistener(obj,'BackgroundColor','PostSet',...
% Establish Listener for PostUpdate event triggered by a background
% color change. Listen to PostUpdate event to reload widget with
% custom background color from AppDesigner.
if isempty(obj.UpdateListener)
obj.UpdateListener = ...
addlistener(obj,'PostUpdate',...
@(h,e)obj.updateBackgroundColorableComponents());
end

Expand Down