Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

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 Ansicht (letzte 30 Tage)
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 Kommentar
Adam
Adam am 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.

Antworten (1)

Jan
Jan am 26 Sep. 2018
Bearbeitet: Jan am 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.

Produkte


Version

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by