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 Center および File ExchangeDevelop 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