When i use "uigetfile" command in App Designer, chose a file and click "open", the whole UIFigure will automatically go under the Matlab-mainwindow and all other files . I must choose the UIFigure again to use it. How to solve it problem.

1 Kommentar

Paola Martin
Paola Martin am 26 Mär. 2023
Could you please explain a little bit more about this problem? i will start doing an app and i was just about to use this command.

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

Adam Danz
Adam Danz am 25 Jul. 2019
Bearbeitet: Adam Danz am 11 Jul. 2025

8 Stimmen

Update
This has been fixed in R2025a. Focus now returns to the app that called uigetfile after the dialog is closed. The fix is also available in the R2024a and R2024b beta releases only (not the R2024a and R2024b general releases).
----------------------original response-------------------------
Wow, that's super annoying (I just confirmed it, r2019a). It's happening in the uigetfile() function.
A workaround is to just call your app figure right after the uigetfile() line.
f = uigetfile();
figure(app.UIFigure)

6 Kommentare

Lixuan Xing
Lixuan Xing am 26 Jul. 2019
thx for your answer
Crownie Eme
Crownie Eme am 26 Okt. 2020
This did not work me. It only brings the appdesigner window back into focus after the file is selceted. I need the uigetfile window in appdesigner not in the main matlab window.
Adam Danz
Adam Danz am 26 Okt. 2020
Based on your descripition, it sounds like it did work for you. The problem the OP describes is that when uigetfile is called, the main App figure goes under the main Matlab development environment (the window containing the command window, workspace var list, etc). The solution is to bring the app's figure back into focus after selecting the file.
The problem you're describing is different and the solution does not address that problem. From what you're saying, the uigetfile window seems to be under another window. Could you describe the workflow that causes the problem? What window is the uigetfile UI under? I could not reproduce this on my end.
Ondrej Mikulas
Ondrej Mikulas am 3 Nov. 2022
2022b and still not fixed. What a shame when AppDesigner is the recommended way for new apps instead of GUIDE.
Thomas Koenig
Thomas Koenig am 2 Dez. 2022
I'm waiting for this to be resolved forever now. It seems like nobody cares. Truly disappointing.
Stuart Fogel
Stuart Fogel am 1 Mai 2023
I also have this issue. From what I've read it's (mostly?) specific to Mac. Running R2202b for Mac.
I got tired of how annoying this was from a user-standpoint, so I created an app in appdesigner that duplicates the functionality of uigetfile. Here's a link to the code in the GitHub repo:
It may not be perfect, so please let me know if something is not quite right.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu App Building finden Sie in Hilfe-Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by