MATLAB Answers

Increasing the figure size in GUI

12 views (last 30 days)
hamzah khan
hamzah khan on 26 Jan 2021
Answered: Geoff Hayes on 26 Jan 2021
I have this gui which is static in size, as shown in pictures
I use the following code to create this figure
function EVRIM_GUI
clear 'all'
f = figure('Visible','off','Units', 'centimeters', 'Position',[0.25,0.75,35.5,16.5]);
AddBody = uicontrol('Style','pushbutton','String','AddBody','Units', 'centimeters','Position',[21.5,15,3,1],'Callback',{@AddBody_Callback});
DrawBodys = uicontrol('Style','pushbutton','String','DrawBody','Units', 'centimeters','Position',[24.5,15,3,1],'Callback',{@DrawBodys_Callback});
ElementMatrices = uicontrol('Style','pushbutton','String','Create Matrices for each Element','Units', 'centimeters','Position',[21.5,14,6,1],'Callback',{@ElementMatrices_Callback});
GlobalMatrices = uicontrol('Style','pushbutton','String','Global Matrix Rigid Without Boundary','Units', 'centimeters','Position',[21.5,11,6,1],'Callback',{@GlobalMatrices_Callback});
CreateMesh = uicontrol('Style','pushbutton','String','CreateMesh','Units', 'centimeters','Position',[27.5,11,3,1],'Callback',{@CreateMesh_Callback});
ClearAll = uicontrol('Style','pushbutton','String','ClearAll','Units', 'centimeters','Position',[21.5,10,3,1],'Callback',{@ClearAll_Callback});
ImportData = uicontrol('Style','pushbutton','String','Import Previous BodyData','Units', 'centimeters','Position',[21.5,7,4,1],'Callback',{@ImportData_Callback});
I didnot write the complete code, because for buttons it is mostly similar.
Now when I go full scree on the gui, the gui increases in size but the position of buttons and the grid size remains the same. As shown:
I want to change it, so when I go full screen, the buttons go on the side and the grid display increases in size. The table belows also change their size
Does anybody knows how to do it?

Answers (1)

Geoff Hayes
Geoff Hayes on 26 Jan 2021
hamzah - try using normalized units instead. See figure units for details.




Community Treasure Hunt

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

Start Hunting!