Uigetfile will make app be behind another windows.
17 次查看(过去 30 天)
显示 更早的评论
I use APP Designer to make a App figure. I want to load my file and display its name,so I use uigetfile. But used uigetfile will make my figure be behind another windows, I have to click it in Taskbar again. Why is this so?
0 个评论
采纳的回答
Ajay Kumar
2019-11-20
add these lines after uigetfile
drawnow;
figure(app.UIFigure)
assuming your UIFigure's name is app.UIFigure
更多回答(5 个)
Melaku Eneayehu
2018-2-20
add the following two lines of code just after uigetfile() app.UIFigure.Visible = 'off'; app.UIFigure.Visible = 'on';
don't forgot to edit figure per-fix if you don't use the default one
0 个评论
Riyadh Abbas
2017-5-26
Hi there, I found a solution to this issue provided by http://undocumentedmatlab.com/blog/solving-a-matlab-hang-problem, which suggested adding two lines drawnow; pause(0.05);
I tried it and it did work for me, hope can solve your problem.
2 个评论
Petar Lambrev
2017-6-12
drawnow; pause(0.05); Does not work for me. After closing get file window, the main app window is in the background.
Chris McRaven
2017-6-16
Matthew Thomas
2019-11-18
This is a duplicate of https://uk.mathworks.com/matlabcentral/answers/296305-appdesigner-window-ends-up-in-background-after-uigetfile , you might find some answers there.
It does seem to be unintended behaviour though, it is frustrating to need to work around this.
0 个评论
Onur Ozdemir
2022-3-14
All given answers address getting the app window back as focus after uigetfile but what is preferred is to prevent it from minimizing in the first place. You can check out my answer to this question here, which is the same question.
0 个评论
Jorg Woehl
2024-5-14
I have just published a simple workaround for these focus issues, which -- as The MathWorks acknowledges -- still have "currently no official workaround". Check out my File Exchange contribution https://www.mathworks.com/matlabcentral/fileexchange/165961-fixfocus.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Develop Apps Using App Designer 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!