uigetfile dialog box pops up behind app window

2 views (last 30 days)
I have created an app in the app designer in which I call uigetfile or uigetdir to load text files with data. It all works just fine, except that the dialog box to select the file/directory pops up behind the app window, and I have to move the app window aside to access the dialog box. When I'm running it on top of MATLAB (in a MATLABWindow) the dialog box appears to be associated with the main MATLAB program (the icon for the main program bounces up and down on my Mac toolbar, and when I click on it I can see the dialog box,) rather than with the app in the MATLABWindow. However, if I compile the app to run as a standalone on Mac or Windows, the dialog box still pops up behind the main app window.
Does anyone know how to fix this?
  4 Comments
Kevin Chng
Kevin Chng on 5 Dec 2018
Do you mind upload your .mlapp? copy them and save them in .m file since here does not accept .mlapp.
Greg
Greg on 6 Dec 2018
I just built a test app with a button that calls uigetfile, and it didn't have a problem. I'm on Win10, R2018b.

Sign in to comment.

Answers (1)

Barry Bickmore
Barry Bickmore on 5 Dec 2018
Ok, I think I figured out a way to do it.
Put this before the call to uigetfile:
app.NameOfYourUIFigure.Visible = 'off';
and this after:
app.NameOfYourUIFigure.Visible = 'on';
  1 Comment
Andrew Davies
Andrew Davies on 27 May 2020
Obviously this will cause your app to disappear, which could be confusing. For instance on my Mac with two displays the file open dialogue appears on a different monitor to the app. So the app just appears to vanish unless you hunt on teh other screen for the open dialogue. R2020a

Sign in to comment.

Categories

Find more on App Building in Help Center and File Exchange

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!