필터 지우기
필터 지우기

How can I go to the next cell in an UITable in app designer by pressing "intro" or "tab"?

조회 수: 11 (최근 30일)
I am using tables in app designer, but I want to write values into the cell and then i want to press "intro" to jump to the next cell, but it is not possible, so I have to click there in the next cell, which is impractical.
Someone here knows how to program that maybe in an event?
  댓글 수: 5
Matt
Matt 2023년 10월 25일
Hi,
I know this is an old question but i'm curious if this is still the case, it would be great to be able to change the focus using tab/enter (or shift tab/enter) as familiar with moving through cells in Excel. Would definitely be a nice feature to have.
Jonas
Jonas 2023년 10월 26일
편집: Jonas 2023년 10월 26일
hey @Matt,
I just had a short look into that and i managed to make the possible to navigate using tab, return or with the modifier shift. however it is not possible to (vusially) move the selection back to the first cell you clicked on. I does not highlight, although the position is set correctly.
I do not know why, but all other cells work.
close all hidden;
fig=uifigure;
tableSize=[4,4];
tbl=uitable(fig,'Data',num2cell(rand(tableSize)),'ColumnEditable',[false true true true]);
tbl.KeyPressFcn={@handleButtons,tableSize};
function handleButtons(src,evt,maxSize)
if isequal(evt.Modifier,{'shift'})
direction=-1;
else
direction=1;
end
if strcmp(evt.Key,'tab')
newPos=src.Selection+[0 direction];
elseif strcmp(evt.Key,'return')
newPos=src.Selection+[direction 0];
else
newPos=src.Selection;
end
% prevent over- and undershoot
newPos=min([newPos;maxSize]);
newPos=max([newPos;[1 1]]);
src.Selection=newPos;
drawnow;
end
at the edges of the table, the tab will lead to a unselection of the table, tabbing again will set the focus on the table again. enter at the lower edge of the table will lead to the edit mode.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by