Application Keyboard Shortcut Problem
조회 수: 2 (최근 30일)
이전 댓글 표시
I am trying to add keyboard shortcuts to my applications. I'm using the WindowKeyPress callback with a series of if/elseif statements with event.Modifier and event.Key comparisons to trigger other button press functions (for example, Ctrl+L will lock/unlock the admin rights, Ctrl+I will initialize the system, Ctrl+S will start testing). Unfortunately, a bunch of those functions end with a uialert (or uiconfirm) letting the user know that the process has ended, and this seems to draw focus away from the figure window, preventing another shortcut without clicking somewhere in the window.
I've tried adding "figure(app.UIFigure)" and "axes(app.UIAxes)" to return focus to either of those elements so that the next shortcut would run, but that didn't work. Is there something here that I'm missing?
댓글 수: 0
답변 (1개)
dpb
2025년 8월 28일
편집: dpb
2025년 8월 28일
It's a known issue that focus doesn't automagically revert back to figure after modal window...you can try using <focus> in your callbacks to set focus to one of the interactive components and see if that helps...it has the side effect of highlighting the selected control that may or may not be desirable, or it may not be suitable for you particular app at all. AFAIK, that's the only other hammer in the tool bag.
댓글 수: 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!