How can i edit to an uitable's cell with only one click ;;;

1 view (last 30 days)
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. :-)

Answers (1)

Joseph Cheng
Joseph Cheng on 1 Oct 2014
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 Comments
Chrysovalantis Nikolaou
Chrysovalantis Nikolaou on 2 Oct 2014
hi Joseph,
thank you for the so quickly answer but it doesn't solve my problem.
If you try to edit to the 1st uitable in any cell, and then go to edit to other uitable, the cell that you choose it's getting blue and you have to click for second on it so as to edit...
this is happening only at the first cell of the uitable, next you just click and edit...
that is what i want to avoid. Am i clear ;;;
Joseph Cheng
Joseph Cheng on 2 Oct 2014
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

Sign in to comment.

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!