Double click callback on a cell in uitable without Java?

3 次查看(过去 30 天)
After google-ing for a while, I cannot find a feasible solution to realize the double click callback on a cell in uitable.
Does anyone have a better idea or workaround for this? without java or findjobj.

回答(1 个)

Walter Roberson
Walter Roberson 2015-9-7
How about CellSelectionCallback and test the figure SelectionType property for 'open' ?
  2 个评论
Song
Song 2015-9-8
Try following codes:
function test()
f = figure('Position',[200 200 400 150]);
dat = rand(3);
cnames = {'X-Data','Y-Data','Z-Data'};
rnames = {'First','Second','Third'};
t = uitable('Parent',f,'Data',dat,'ColumnName',cnames,...
'CellSelectionCallback', @cbk, ...
'RowName',rnames,'Position',[20 20 360 100]);
function cbk(~, ~)
ty = get(f, 'SelectionType')
end
end
You'll see only normal comes out from the selectiontype.
Stefanie Schwarz
Stefanie Schwarz 2020-10-2
编辑:Stefanie Schwarz 2020-10-2
In R2020a and ealier, 'SelectionType' was not honorored by UItables; starting from R2020b, the above solution should work.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Environment and Settings 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by