Application Keyboard Shortcut Problem
20 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (1)
dpb
il 28 Ago 2025 alle 15:35
Modificato: dpb
il 28 Ago 2025 alle 19:09
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 Commenti
Vedere anche
Categorie
Scopri di più su Startup and Shutdown in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!