I have some issues with positioning and the dimension for different kind of objects, for the following code. When you resize the figure, you can see that the button and listbox have always the same size and position to each other.
I would like to set the position and dimension of the panel and axes like that, too. I don´t want to get the objects resized, when the user is changing the figure size and I want to get a full screen at the beginning as well.
Is there any possibility to do that?
function GUI() close all data = createData(); gui = createInterface(); function data = createData() data.Test_data = {'Test1','Test2','Test3', 'Test4'}; data.arrow_p1 = [0.5 1]; % Startpunkt x1,y1
data.arrow_p2 = [0 -1]; % Breite des Pfeils = 0 und Länge des Pfeils mit Richtung -1 (nach unten)
data.Dir_path = pwd; assignin('base','data', data); end function gui = createInterface() % Gui creation
gui.Window = figure('Units','normalized','OuterPosition',[0 0 0.9 0.9],... 'Name','Test', ... 'NumberTitle', 'off','MenuBar', 'none'); % Menübar
gui.FileMenu1 = uimenu( gui.Window, 'Label', 'Datei' ); gui.FIleMenu5 = uimenu( gui.FileMenu1, 'Label', 'Beenden', 'Callback', @onExit ); gui.FileMenu2 = uimenu( gui.Window, 'Label', 'Speichern' ); % Panel
gui.panel = uipanel('Units','normalized','Title','Panel','FontSize',10,'Position',[.01 .5 .25 .5]); % Checkbox
for k=1:4 gui.checkbox{k} = uicontrol('parent',gui.panel,'Style','checkbox','string',data.Test_data(1*k),... 'Position',[10 350-k*20 150 20]); end % Listbox
for s=1:5 gui.Listbox_{s} = uicontrol('Style','listbox','Position',[300+200*s 400 120 100],'Visible','On'); end % Button
for x=1:5 gui.Button_{x} = uicontrol('Style','pushbutton','Position',[300+200*x 500 120 40]); end % Axes
gui.axes = axes('Outerposition',[.335 .65 .05 .1],'Visible','Off'); % Arrow
h=annotation('textarrow','String','Test Arrow in Axes '); %%arrow, doublearrow, textarrow
set(h,'parent', gui.axes, 'position', [data.arrow_p1,data.arrow_p2], ... 'HeadLength', 5, 'HeadWidth', 5, 'HeadStyle', 'vback2', ... 'Color', [0 0 0], 'LineWidth', 0.5); end end
Best Answer