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

조회 수: 6 (최근 30일)
Chrysovalantis Nikolaou
Chrysovalantis Nikolaou 2014년 10월 1일
댓글: Joseph Cheng 2014년 10월 2일
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. :-)

답변 (1개)

Joseph Cheng
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
Chrysovalantis Nikolaou
Chrysovalantis Nikolaou 2014년 10월 2일
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 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

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by