Strange UI behaviour in App Designer

I am designing an app in App Designer but sometimes when I run the app the UI becomes broken (see first image) and I have to run the app again for the UI to render as intended (see second image). I have used the 2-Panel App with Auto-Reflow template to start designing this app. I'm not providing any code snippets as I don't know where the problem might originate from and because the problem appears even if I don't make any changes that affect the UI of the app.

6 Comments

Here are a few questions to start:
Are you adjusting the position of the UIFigure with a startup function or when you create components? Do you use normalized units, which are not supported with App Designer? (if so, I can show you a workaround). Is the app in fullscreen mode?
1. No, I don't adjust the position of the UIFigure. I do change the ColumnWidth and RowHeight of the GridLayout in the StartupFcn though.
drawnow
fig_position = app.UIFigure.Position;
fig_width = fig_position(3);
fig_height = fig_position(4);
app.GridLayout.ColumnWidth = {0.54*fig_width, 0.46*fig_width};
app.GridLayout.RowHeight = fig_height;
2. Yes, I use normalized units as much as possible.
3 . Yes, the app is in fullscreen mode.
After you use normalize units, convert the units back to pixels. This should fix the issue.
@Kevin Holly Could you please elaborate on that? Where and why should I convert the units back to pixels? This doesn't feel like it's the source of the problem.
@John F I had an issue with an app while using Auto-Reflow in the past when I used the unsupported normalized units. Switching back to pixel units resolved my issue. So, I'm not 100% sure that its the issue, just a guess based on my past experience. As for an example, I would add the following line after adjusting the position of your axes (assuming you did this programmatically after converting to normalize units):
app.UIAxes.Units = 'pixels'
Giving it a second look, I noticed you are using R2020b. Have you trying running the app in the lastest release?
@Kevin Holly This seems to work if I use drawnow with it. For example:
drawnow
MyPanel = uipanel(app.LeftPanel,"Units","normalized", "Position",[0 0.8 1 0.2]);
drawnow
MyPanel.Units = 'pixels';
However, if I add this to non-problematic panels, it breaks the problematic one, which is strange.
Also, I can't test this in the latest release because R2020b is the newest version my licence gives me access to.

Sign in to comment.

Answers (0)

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Products

Release

R2020b

Asked:

on 26 Apr 2022

Edited:

on 29 Apr 2022

Community Treasure Hunt

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

Start Hunting!