1

回调用于将所选单元格添加到同一 uifigure 中的另一个 uitable 但它是行为更改,它大多数时候会进行双重回调,有时它只需要正确行为的单一回调。

是任何可以查看的设置。最近从 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

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

4

1 回答 1

0

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

于 2019-10-02T09:23:22.003 回答