Uigetfile will make app be behind another windows.

12 Ansichten (letzte 30 Tage)
Shao-Qi Lei
Shao-Qi Lei am 21 Dez. 2016
Beantwortet: Jorg Woehl am 14 Mai 2024
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?

Akzeptierte Antwort

Ajay Kumar
Ajay Kumar am 20 Nov. 2019
add these lines after uigetfile
drawnow;
figure(app.UIFigure)
assuming your UIFigure's name is app.UIFigure

Weitere Antworten (5)

Melaku Eneayehu
Melaku Eneayehu am 20 Feb. 2018
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

Riyadh Abbas
Riyadh Abbas am 26 Mai 2017
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 Kommentare
Petar Lambrev
Petar Lambrev am 12 Jun. 2017
drawnow; pause(0.05); Does not work for me. After closing get file window, the main app window is in the background.
Chris McRaven
Chris McRaven am 16 Jun. 2017
This does not work for me either. I have described my steps to reproduce here.

Melden Sie sich an, um zu kommentieren.


Matthew Thomas
Matthew Thomas am 18 Nov. 2019
It does seem to be unintended behaviour though, it is frustrating to need to work around this.

Onur Ozdemir
Onur Ozdemir am 14 Mär. 2022
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.

Jorg Woehl
Jorg Woehl am 14 Mai 2024
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.

Kategorien

Mehr zu Dialog Boxes finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by