Issue with Matlab Widget toolbox: ListSelector call back is exectued twice

4 Ansichten (letzte 30 Tage)
Sylvain
Sylvain am 6 Mai 2025
Beantwortet: Hitesh am 13 Mai 2025
I have created the following app as a demonstration:
classdef debugListSelector < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
UIFigure matlab.ui.Figure
ListSelector wt.ListSelector
end
% Callbacks that handle component events
methods (Access = private)
% Callback function: ListSelector
function ListSelectorButtonPushed(app, event)
disp("executing action")
end
end
% Component initialization
methods (Access = private)
% Create UIFigure and components
function createComponents(app)
% Create UIFigure and hide until all components are created
app.UIFigure = uifigure('Visible', 'off');
app.UIFigure.Position = [100 100 640 480];
app.UIFigure.Name = 'MATLAB App';
% Create ListSelector
app.ListSelector = wt.ListSelector(app.UIFigure);
app.ListSelector.AddSource = 'ButtonPushedFcn';
app.ListSelector.ButtonPushedFcn = createCallbackFcn(app, @ListSelectorButtonPushed, true);
app.ListSelector.Position = [149 75 232 282];
% Show the figure after all components are created
app.UIFigure.Visible = 'on';
end
end
% App creation and deletion
methods (Access = public)
% Construct app
function app = debugListSelector
% Create UIFigure and components
createComponents(app)
% Register the app with App Designer
registerApp(app, app.UIFigure)
if nargout == 0
clear app
end
end
% Code that executes before app deletion
function delete(app)
% Delete UIFigure when app is deleted
delete(app.UIFigure)
end
end
end
I have no idea how to fix this

Antworten (1)

Hitesh
Hitesh am 13 Mai 2025
I too encountered the same issue. The workaround that worked for me was to update Widgets Toolbox - App Designer and Advanced App Components - File Exchange - MATLAB Central version to 2.4.2.
For more information regarding "Widgets Toolbox File Exchange". Kindly refer to following discussion section:

Kategorien

Mehr zu Develop uifigure-Based Apps finden Sie in Help Center und File Exchange

Produkte


Version

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by