Double click callback on a cell in uitable without Java?

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 日

0 投票

How about CellSelectionCallback and test the figure SelectionType property for 'open' ?

3 件のコメント

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.
Jesse Hopkins
Jesse Hopkins 2025 年 3 月 3 日
Using 2021B at the moment, and above solution **mostly** works, except if one double clicks a cell that's already selected. In this case, the CellSelectionCallback is never fired at all. Curious if there's any solution for detecting a double-click in a cell that's already selected?

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeApp Building についてさらに検索

質問済み:

2015 年 9 月 7 日

コメント済み:

2025 年 3 月 3 日

Community Treasure Hunt

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

Start Hunting!

Translated by