Setting focus in AppDesigner
조회 수: 41 (최근 30일)
이전 댓글 표시
I'm setting a TextArea object to be editable with a menu selection to allow a field to be updated by the user.
The callaback to do so works fine but it is annoying to have to manually select the text area to get it to have focus and then do the edits.
Is there any way programmatically for the menu callback function to shift focus to the textarea object?
This is in an AppDesigner application.
댓글 수: 0
답변 (2개)
Adam Danz
2022년 4월 5일
> Is there any way programmatically for the menu callback function to shift focus to the textarea object?
Yes, starting in MATLAB R2022a.
Use the new focus(c) function to set focus to a ui component c. This MATLAB release also provides additional resources to control the focus order of ui components in AppDesigner.
More info
댓글 수: 0
Kevin Holly
2021년 9월 29일
I found this question here: https://www.mathworks.com/matlabcentral/answers/353504-give-focus-to-an-edit-field
댓글 수: 5
Sean de Wolski
2022년 1월 3일
You may be interested in the R2022a prerelease. And while you're looking at it, you may be interested in typing >>doc focus
참고 항목
카테고리
Help Center 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!