Handling the size of MATLAB GUI programmatically?

I have a matlab GUI whose resize behavior property is set to "Proportional". This is good if I want to increase the size of GUI i.e. the size of all components (Pushbuttons etc.) increase in proportion to the size of GUI figure. The problem occurs when I reduce the size of GUI figure. Reducing the size beyond a point distort the shapes and appearance of GUI components.
What I want is a way by which I can fix a minimum size of my GUI and from there it can be resized proportionally.

 Accepted Answer

I tried a lot inside Matlab without success: Catching the position in the ResizeFcn and setting it to a specific limit, did not work reliably. Therefore I've used the Java method in http://mathworks.com/matlabcentral/fileexchange/38527-limit-figure-size. Unfortunately this failed in R2011b, but I assume it is working in modern Matlab versions again.

3 Comments

Adam
Adam on 27 Oct 2016
Edited: Adam on 27 Oct 2016
The version I have works fine in recent versions, although I notice mine is called LimitSizeFig while the latest zip contains LimitFigSize. I assume it got renamed at some point since one of the comments on the submission mentions LimitSizeFig so it isn't an edit I did.
I did edit it for my use, but just to suppress a warning that I don't care about.
Edit: I have now updated mine and all its usages to the latest version and it works fine in R2016b too.
Thanks a lot Simon. You answers are always helpful.
Simon I am having an error in line 147. it says:-
Struct contents reference from a non-struct array object

Sign in to comment.

Categories

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

Tags

Community Treasure Hunt

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

Start Hunting!