How to resize all children automatically when creating a uifigure with uibuttons etc?

3 ビュー (過去 30 日間)
Z.P.
Z.P. 2018 年 10 月 19 日
コメント済み: Z.P. 2018 年 10 月 23 日
Hello dear MATLAB folks,
I want to create a GUI with the uifigure command.
uifg1=uifigure;
Then I place a button
uibt1=uibutton('parent',uifg1);
I also check that
uifg1.AutoResizeChildren = 'on'
but when i resize the uifg1 with my mouse it does not resize the button.
I can't use GUIDE, because the GUI must be modular expandable.
  10 件のコメント
Rik
Rik 2018 年 10 月 22 日
The toolbox is not one by Mathworks, but it is on the FEX, so you can just use it. I can't really tell if it is simply a design tool, or if it is required to run it, but you may be allowed to package this with you GUI.
Adam
Adam 2018 年 10 月 22 日
You can package any components that are needed into an executable. They are just .m files.

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

回答 (1 件)

Z.P.
Z.P. 2018 年 10 月 23 日
I solved it with a "scale button". I wrote a function that finds all children of a GUI and then scales them child by child.
  2 件のコメント
Adam
Adam 2018 年 10 月 23 日
Was it not possible to do the same code you put under that button in the SizeChangedFcn of the figure so that it happens automatically?
Z.P.
Z.P. 2018 年 10 月 23 日
Well this could be possible but it was easier for me now to click on a button instead of doing some resizing with the mouse.
I really wanted to make this happen when the GUI is being moved somewhere, but this nice super duper "scale button" is exactly what I want to have.
But to come back to your question: It should be possible but it would just be trigered if you really resize it by the mouse. And that was not really i wanted.
Thank you anyway ;)

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

カテゴリ

Help Center および File ExchangeCreating, Deleting, and Querying Graphics Objects についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by