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

3 views (last 30 days)
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 Comments
Rik
Rik on 22 Oct 2018
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 on 22 Oct 2018
You can package any components that are needed into an executable. They are just .m files.

Sign in to comment.

Answers (1)

Z.P.
Z.P. on 23 Oct 2018
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 Comments
Adam
Adam on 23 Oct 2018
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. on 23 Oct 2018
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 ;)

Sign in to comment.

Categories

Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!