gui coded with uifigure

5 ビュー (過去 30 日間)
Alain Barraud
Alain Barraud 2024 年 6 月 17 日
コメント済み: Alain Barraud 2024 年 8 月 14 日
Hi every body,
I have coded a moderatly complex gui first within a standard figure and a second version within a uifigure. As usually observed the second version is very very slow compared against the first one. This is not my problem. To obtain a correct gui I must execute ma code in debug mode step by step. Otherwise, the gui is very strange as if each graphic object was not finished before the next one begins to be buit. I have tried to add pause, drawnow, drownow limiterate, uifigure visible off until the last command... Nothing works.
Any idea to find a workaround?
Thank a lot
  17 件のコメント
Alain Barraud
Alain Barraud 2024 年 6 月 27 日
yes!! see included file
Mario Malic
Mario Malic 2024 年 6 月 28 日
編集済み: Mario Malic 2024 年 6 月 28 日
Alright, I have encountered this issue. I think what helps is, if you resize the figure, and it will update the layout.
I don't know the reason why this would happen.

サインインしてコメントする。

採用された回答

Alice
Alice 2024 年 8 月 10 日
For figures created via the uifigure() function and for containers within a uifigure, the property AutoResizeChildren will be 'on' by default. This means that AutoResizeChildren will try to resize the content when the uifigure is resized, without the need to write a SizeChangedFcn callback or to use uigridlayout.
An important note about AutoResizeChildren: it will resize components even if the components are in normalized units, and treat them as if they were in pixels units.
In this case, AutoResizeChildren on the panel that contains the uitabgroup is not working well because the panel is positioned by a uigridlayout, but the content is absolutely positioned. It is not recommended to mix absolute positioning and use of uigridlayout.
Here is my recommendation:
- If you would like to leverage normalized units, turn off AutoResizeChildren on all containers within the uifigure using the following right after the uifigure call:
set(IdD.Container, 'DefaultUipanelAutoresizechildren', 'off');
set(IdD.Container, 'DefaultUitabAutoresizechildren', 'off');
- Alternatively, use uigridlayout throughout the app. In other words, insert a uigridlayout between containers and their content, e.g. between the uipanel and the uitabgroup, and between the uitab and the axes.
  1 件のコメント
Alain Barraud
Alain Barraud 2024 年 8 月 14 日
The code I sent works correctly adding this two lines. I think using uifigure and coding manually must be done very rigouresly. My full code using uifigure does not work correctly the GUI remains very strange with superposition or bad sized components. The figure version works nicely without any issues.
Thanks a lot for the time spent around this question
Alain

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDialog Boxes についてさらに検索

タグ

製品


リリース

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by