フィルターのクリア

Resizing grid layout doesn't work in maximized WindowState

4 ビュー (過去 30 日間)
John F
John F 2022 年 3 月 24 日
回答済み: John F 2022 年 3 月 24 日
I have created an App using the "2-panel App with Auto-Reflow" template and I want to change the width of the 2 panels. Here's the relevant code:
function startupFcn(app)
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;
end
I have also set the WindowState property of the UIFigure element to 'maximized'. However, the panels don't have the correct width. What am I missing?

採用された回答

John F
John F 2022 年 3 月 24 日
Add "drawnow" at the beginning of the function like this:
function startupFcn(app)
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;
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by