Change keyboard focus in MATLAB GUI

조회 수: 1 (최근 30일)
Adham Elkhouly
Adham Elkhouly 2020년 5월 9일
댓글: Harsha Priya Daggubati 2020년 5월 12일
I am trying to allow the user to press return or space to enter values, so whenever they press these keys, no matter where the crusor is, a certain callback must be intiated. What happens is that the GUI loses focus whenever I press on the editable fields and start writing values, but if I pressed on the button manualy the enter and space keys regain focus.
the code block where I define these keyboard keys is
function keyPressCallback(source,eventdata)
keyPressed = eventdata.Key;
if strcmpi(keyPressed,'space') | strcmpi(keypressed, 'return')
uicontrol(app.FillTableButton);
snapshot_callback(app.FillTableButton,[]);
end
end
Please anyone has an idea how to solve this issue?
Thank you
  댓글 수: 5
Adham Elkhouly
Adham Elkhouly 2020년 5월 11일
Can you please show me how and where I can do so?
Thank you
Harsha Priya Daggubati
Harsha Priya Daggubati 2020년 5월 12일
Hi,
Since you mentioned you are new to MATLAB's GUI, you can refer the following documentation to help you gain more clarity in adding calbacks in Appdesigner.

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

답변 (0개)

카테고리

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

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by