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

4 visualizzazioni (ultimi 30 giorni)
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. :-)

Risposte (1)

Joseph Cheng
Joseph Cheng il 1 Ott 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 Commenti
Chrysovalantis Nikolaou
Chrysovalantis Nikolaou il 2 Ott 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 il 2 Ott 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

Accedi per commentare.

Categorie

Scopri di più su Programming in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by