Hi John,
I understand that you have created a panel within a UI figure in App Designer, and when you maximize the figure, the child panel does not maximize with it (it maintains its original dimensions). However, when you minimize the figure, the panel also minimizes as expected.
In the code, you have set the “AutoResizeChildren” property of parent figure to “on”, and on investigating I found that this is the expected behavior of the property. When “AutoResizeChildren” property is set as “on”, the child element minimizes when the parent figure is minimized, but the child element maintains its default size when the parent figure is maximized.
A possible workaround, to resize the child panel to always match the parent figure size, can be to create a custom size changed function, and set the “AutoResizeChildren” of parent figure to “off”. The custom function needs to be assigned to “SizeChangedFcn” property of parent UI figure, so that it maintains the size of child panel whenever the size of parent UI figure changes.
Below is the App Designer code that addresses this task:
x_y_window=uifigure('Name','X Y Values');
x_y_window.AutoResizeChildren='off';
% Create a panel for the X setup and data
x_panel=uipanel('Parent',x_y_window);
%X panel configuration
function customSizeChangedFunction(src, ~)
% Get the current size of the uifigure
size_of_my_window = src.Position;
% Calculate new position for the panel to fill the entire window
x_panel.Position = [10, 10, size_of_my_window(3) - 20, size_of_my_window(4) - 20];
end
% Attach the custom size change function to the SizeChangedFcn of the uifigure
x_y_window.SizeChangedFcn = @customSizeChangedFunction;
% Initial call to set the position
customSizeChangedFunction(x_y_window);
% X panel visualization
x_panel.Title='X Value Setup';
x_panel.TitlePosition='centertop';
Attaching the documentation of “uipanel” in App Designer for reference:
I anticipate this will solve the problem.