How do I make a uibutton the 'active' item in a GUI upon construction?
1 次查看(过去 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!
0 个评论
采纳的回答
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 个评论
更多回答(0 个)
另请参阅
类别
在 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!