Stop uitable from appending to cell when you type
信息
此问题已关闭。 请重新打开它进行编辑或回答。
显示 更早的评论
In uitable with a table as data, if you single click a cell and start typing, it will append to the existing extry with what you type. Any idea how I can get it to behave like Excel, where you single click a cell, start typing, it will replace what was there with what you type?
f = uifigure;
tData = table(0, 0, 0);
uit = uitable(f, 'Data', tData, 'ColumnEditable', [true true true]);
0 个评论
回答(1 个)
Walter Roberson
2019-7-17
0 个投票
Use the uitable cell selection callback. When the callback fires, look at the position indicated in the event data, and set that entry to be empty -- so clicking on an entry erases the entry, leaving you positioned to type in new content.
Note that this requires that the entries are all character and not numeric, as you cannot set a numeric entry to pure whitespace with this technique.
1 个评论
Jeremy
2019-7-17
此问题已关闭。
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!