GUI resize pixel limit

6 visualizaciones (últimos 30 días)
Tom Tang
Tom Tang el 24 de Jul. de 2012
Hi, I am pretty new to Matlab and I am making a gui. I want the gui to be resizable. Everything works fine until someone tries to make the gui really small so all the panels and works get messed up. Is there anyway to stop the users from making the gui too small? Say setting 800*600 is the minimum one can resize it to. Thank you.

Respuestas (2)

Walter Roberson
Walter Roberson el 24 de Jul. de 2012

Jan
Jan el 25 de Jul. de 2012
Editada: Jan el 26 de Jul. de 2013
I've tried several methods without success to limit the size of a figure in the ResizeFcn. In older Matlab versions the event was triggered when the mouse is moved, while for newer versions the event appears, when the mouse is released. If a method worked when the resize-handle on the right bottom is dragged, it failed, when the left figure edge is dragged.
The only stable method I've found is the undocumented Java interface:
jFrame = get(handle(gcf), 'JavaFrame');
try
jProx = jFrame.fFigureClient.getWindow;
catch
jProx = jFrame.fHG1Client.getWindow; % [EDITED] Fallback
end
jProx.setMinimumSize(java.awt.Dimension(200, 200));
If TMW really decides to omit the JavaFrame property in the future, all these tricks become useless. Therefore please send a request to the technical support, that you use this feature and want it to be supported in the future, see http://www.mathworks.com/support/contact_us/dev/javaframe.html . When you get the reply, that figures and GUIs are not handles by Java, but by the faster, smarter and nicer Qt framework, please post this as soon as possible. :-)
  2 comentarios
Tom Tang
Tom Tang el 25 de Jul. de 2012
How do I implement this in matlab? I have never used java in matlab. Thank you.
Jan
Jan el 26 de Jul. de 2013
If you still wait for the answer: This is pure Matlab code and you can insert it directly to your code.

Iniciar sesión para comentar.

Categorías

Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by