Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

I'm trying to set a GUI created by guide as resizeable using the GUI options dialog box. (shown below) When i turn this option on, a few pop up boxes do not work. Can someone help me out?

1 vue (au cours des 30 derniers jours)
Gaurav Wadhwa
Gaurav Wadhwa le 25 Sep 2018
Clôturé : MATLAB Answer Bot le 20 Août 2021
Is there an alternative route to resize a moderately complex gui ? ( 25+ GUI objects)
I'm not averse to writing a code for the resize function. I'm just not sure where such a function would be located, and if it would need any default parameters that make it compatible with GUIDE ?
  1 commentaire
Adam
Adam le 26 Sep 2018
I tend to use this toolbox for building complex UIs nowadays. It includes layouts which you can parameterise and will behave more sensibly when you resize your GUI.
I've never tried crowbarring them into an existing GUIDE GUI, but it is theoertically possible as it is all just a case of parenting of objects so you can reparent things from a GUIDE GUI to layouts in theory.

Réponses (1)

Jan
Jan le 26 Sep 2018
Modifié(e) : Jan le 26 Sep 2018
"Does not work" is not clear enough to understand, what happens or to suggest an improvement.
You can create a ResizeFcn easily. It is located in the M-file, where the other callbacks are found also. Using the handles of the uicontrol elements stored in the handles struct, it is not much work to assign new positions. A small example without using GUIDE:
% UNTESTED! Please debug by your own
function CreateGUI
handles.FigH = figure('SizeChangedFcn', @Resize, ...
'Position', [100, 100, 640, 480]);
handles.ButtonH = uicontrol('Style', 'PushButton', ...
'Position', [10, 440, 620, 30], ...
'Units', 'Pixels', 'String', 'Button');
guidata(handles.FigH, handles);
end
function Resize(FigH, EventData)
handles = guidata(FigH);
Pos = get(FigH, 'Position');
% Keep the button on the top and adjust the width:
set(handles.ButtonH, 'Position', [10, Pos(4) - 40, Pos(3) - 20, 30]);
end
By the way: "SizeChangedFcn" is the modern version of "ResizeFcn".
This works equivalently in GUIDE.

Produits


Version

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by