필터 지우기
필터 지우기

How do I make a uibutton the 'active' item in a GUI upon construction?

조회 수: 3 (최근 30일)
I would like to have a button on an appDesigner GUI that is highlighted upon opening, giving the user the option of quickly dismissing the GUI by pressing the Enter Key or Spacebar.
If the GUI has the button as the first element, I can hit tab, then spacebar/enter to trigger the callback, but I would like a single keypress option. Does anyone know of a way to do this?
Thanks!

채택된 답변

Kevin Holly
Kevin Holly 2023년 6월 23일
편집: Kevin Holly 2023년 6월 23일
Below would work for R2022a and later.
You can add
focus(app.Button)
to the startup function. To add a startup function, click Callback on the toolstrip while in Code View.
  댓글 수: 2
Alan Bindemann
Alan Bindemann 2023년 6월 23일
That's exactly what I need, but I am restricted to development in a version earlier than R2022a at the present time. Thanks for the reply though.
Cheers.
Kevin Holly
Kevin Holly 2023년 6월 23일
Please see the link in the previous comment.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by