- Figure Properties: https://www.mathworks.com/help/matlab/ref/matlab.ui.figure-properties.html#buiwuyk-1-WindowKeyPressFcn
- https://www.mathworks.com/matlabcentral/answers/33224-gui-figure-focus
- https://www.mathworks.com/matlabcentral/answers/1907220-keypress-callback-not-working-for-a-second-called-uifigure
WindowKeyPressFcn blocked when a uiprogressdlg is active - any workarounds?
4 次查看(过去 30 天)
显示 更早的评论
I have a WindowKeyPressFcn on a uifigure and I would like it to continue to respond to key presses when a uiprogressdlg is active.
It appears that the uiprogressdlg blocks events going to the figure.
But uiprogressdlg does not appear to have any ability to add any key/button handlers directly to it. Only the ability to add the 'cancelable' button, which does not actually fire a callback when pressed.
I already tried inspecting the hidden properties of the uiprogressdlg object via struct(), and I can find handles back to the parent figure, but nothing that appears to be a control or object for the uiprogressdlg where I could add event handlers.
Are there any workarounds to this?
0 个评论
回答(1 个)
Abhas
2025-2-24
When a "uiprogressdlg" is active, it captures focus, preventing the "WindowKeyPressFcn" on the "uifigure" from receiving key press events. Since "uiprogressdlg" does not expose any direct event handlers for key presses, the figure’s "WindowKeyPressFcn" does not execute when the dialog is in focus.
To resolve this and have the key interaction linked to all subcomponents within the figure, the "WindowKeypressFcn" should be used by setting the focus back to the figure.
You may refer the below documentation and MATLAB Answers link to know more about the same:
I hope this helps!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Install Products 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!