UITable 不断进行双 CellSelect 回调



回调用于将选定的单元格添加到同一 uifigure 中的另一个可调用对象,但它的行为发生了变化,它大多数时候会进行双重回调,有时它只是单个正确的行为需要的。

是可以查看的任何设置。最近从R2018b升级到R2019a,它具有更多的功能和行为,尤其是表格。

有什么解决办法吗?

我尝试使用编辑器和 disp(( 进行调试,显示输出,在发生双重回调的地方。

%%%% Else where in the code, for ref with question
app.table.CellSelectionCallback = @(src, event)ItemSelected_Callback(app, event);
% add the selected item to the selection table;
% enable edit and remove buttons if there was no item before
% (if there was a item before, the buttons are already enabled)
function ItemSelected_Callback(app, event)
disp(event.Indices);
row = event.Indices(1, 1);
[n, ~] = size(app.Selection_table.Data);
data = cell(n+1, 1);
for c = 1:n
data{c} = app.Selection_table.Data{c};
end
data{n+1} = char(AddItem.genItemcode(app.table.Data{row, 2}, app.table.Data{row, 3}, app.table.Data{row, 4}, app.table.Data{row, 5}, app.table.Data{row, 6}, app.table.Data{row, 7}, app.table.Data{row, 8}, app.table.Data{row, 9}, app.table.Data{row, 10}, app.table.Data{row, 11}, app.table.Data{row, 12}, app.table.Data{row, 13}, app.table.Data{row, 14}, app.table.Data{row, 15}, app.Fluid_DropDown.Value, app.dbConn));
app.Selection_table.Data = data;
if app.selectionLine < 1
app.remove_button.Enable = 'on';
app.edit_button.Enable = 'on';
app.selectionLine = 1;
end
end

预期:单个回调,因此单个条目进入第二个表。

这可能在 R2019a 中存在错误,因为 R2019b 会解决它。

最新更新