App components shift position

22 ビュー (過去 30 日間)
MathWorks Support Team
MathWorks Support Team 2022 年 10 月 27 日
回答済み: MathWorks Support Team 2022 年 11 月 14 日
I updated MATLAB from 2021b to 2022b, and a new issue has emerged. 
When I run the app with App Designer the position of all of the components in the Left Panel of the app are shifted. 
The components look correct in Design View, and the correct positions are listed for each component before the code runs. 

採用された回答

MathWorks Support Team
MathWorks Support Team 2022 年 10 月 27 日
WORKAROUND 1:
Use uigridlayout to place and resize the components, instead of relying on auto resize:
- In AppDesigner, open the app, and right click on the LeftPanel (in an empty space, not on a component), and select "Apply Grid Layout". This will insert a uigridlayout between the LeftPanel and the components.
- Adjust the grid configuration as needed.
- Repeat for the RightPanel.
WORKAROUND 2. (not as robust workaround 1 as the amount of pause is not deterministic).
Add the following at the beginning of the startupFcn:
app.LeftPanel.AutoResizeChildren = 'off';
app.RightPanel.AutoResizeChildren = 'off';
drawnow;
pause(2);
app.LeftPanel.AutoResizeChildren = 'on';
app.RightPanel.AutoResizeChildren = 'on';

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeEnvironment and Settings についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by