MATLAB Answers

app.UIfigure.Visible does not keep the app window on top of all other windows

23 views (last 30 days)
farzad
farzad on 21 Mar 2020
Commented: Cris LaPierre on 24 Mar 2020
Hi all
using the following line does not really keep the app window in appdesigner on top of all other windows , I have two pushbuttons and for each, the window should remain on top:
app.UIFigure.Visible = 'on';

  0 Comments

Sign in to comment.

Accepted Answer

Cris LaPierre
Cris LaPierre on 21 Mar 2020
Edited: Cris LaPierre on 21 Mar 2020
Try using drawnow with the figure command in your button callbacks (see this post)
drawnow;
figure(app.UIFigure)

  10 Comments

Show 7 older comments
Cris LaPierre
Cris LaPierre on 23 Mar 2020
That explains it. You need to use the second solution from that post:
"For releases prior either turn the visibility off and on again or use the attached p file (change extension from .zip to .p). The usage then would be"
uigetfile; % Could be other dialogs here
drawnow;
FocusUIFigure(app.UIFigure)
farzad
farzad on 24 Mar 2020
Thank you Cris, but I got an error
Undefined function 'FocusUIFigure' for input arguments of type 'matlab.ui.Figure'.
Error in app120/ChooseDirectoryButtonPushed (line 27)
FocusUIFigure(app.UIFigure)
Error using matlab.ui.control.internal.controller.ComponentController/executeUserCallback (line 309)
Error while evaluating Button PrivateButtonPushedFcn.
Cris LaPierre
Cris LaPierre on 24 Mar 2020
FocusUIFigure is a custom function that is attached to the post I linked you to. You'll have to download it in order to use it.

Sign in to comment.

More Answers (0)

Sign in to answer this question.


Translated by