widgets-toolbox icon indicating copy to clipboard operation
widgets-toolbox copied to clipboard

Custom background color of widget should be set upon reloading app in AppDesigner

Open slootsjj opened this issue 1 year ago • 0 comments

Recreate issue Create app in AppDesigner Add widget to app Change background color to blue Save and close app. Load app again in AppDesigner. --> Background of widget appears as default color.

Proposed fix Listen to 'PostUpdate' event in BackgroundColorable mixin class to ensure a widget's custom background color appears in AppDesinger upon reloading the app. Changing the background color of the widget will trigger the widget's update method as well.

function listenForBackgroundChange(obj)

    % Establish Listener for Background Color Change
    if isempty(obj.BackgroundColorListener)
        obj.BackgroundColorListener = ...
            addlistener(obj,'PostUpdate',...
            @(h,e)obj.updateBackgroundColorableComponents());
    end

end %function

slootsjj avatar Apr 19 '24 08:04 slootsjj