How can i edit to an uitable's cell with only one click ;;;
4 次查看(过去 30 天)
显示 更早的评论
hello, i create two uitables
DataX = cell(1,px);
DataY = cell(1,py);
when i fill the cells of the 1st uitable with my values and go to the next one, the 1st cell that i will choose to edit, i have to double click to edit.
My question is how can i edit only with one click, even at 1st or 2nd uitable
thanks in Advance. :-)
0 个评论
回答(1 个)
Joseph Cheng
2014-10-1
You can try to do something like this
function Untitled()
f = figure
data = rand(3);
colnames = {'X-Data', 'Y-Data', 'Z-Data'};
t1 = uitable(f, 'Data', data, 'ColumnName', colnames, ...
'Position', [20 20 260 100],'ColumnEditable',[true true true true])
set(t1, 'CellSelectionCallback',{@activate});
data = rand(3);
colnames = {'X-Data', 'Y-Data', 'Z-Data'};
t2 = uitable(f, 'Data', data, 'ColumnName', colnames, ...
'Position', [20 140 260 100],'ColumnEditable',[true true true true])
set(t2, 'CellSelectionCallback',{@activate});
function activate(hobject,event)
uitable(hobject);
Probably some better way to implemented but for 5 min its not too bad and something you can build upon.
3 个评论
Joseph Cheng
2014-10-2
I concede that yes the other table stays highlighted. I'm sure you could figure out how to select. Simple enough to test out to unset, however after clicking to the other box you do not need to double click. just type in anything after the first click
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!