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

조회 수: 4 (최근 30일)
Sylvain
Sylvain 2025년 5월 6일
답변: Hitesh 2025년 5월 13일
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

답변 (1개)

Hitesh
Hitesh 2025년 5월 13일
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:

카테고리

Help CenterFile Exchange에서 Develop uifigure-Based Apps에 대해 자세히 알아보기

제품


릴리스

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by