Hello everyone! So i am kind of new to MATLAB. I created a UI with tabs, however when i maximise the UI figure, the tabs do not resize along with it. How can i manage this? Thank you in advance.

1 view (last 30 days)
clear all
clc
%Creating Tabs
fig = uifigure("Name","BISC");
set(fig, 'Units', 'normalized', 'Position', [0.1, 0.1, 0.8, 0.8]);
tg = uitabgroup(fig,'Units','normalized',"Position",[0,0,1,1]);
t1 = uitab(tg,"Title","Data");
tg1 = uitabgroup(t1,'Units','normalized',"Position",[0,0,1,1]);
t3 = uitab(tg1, 'Title', 'Tab 3');
t4 = uitab(tg1, 'Title', 'Tab 4');
t2 = uitab(tg,"Title","Plots");
tg2 = uitabgroup(t2,'Units','normalized',"Position",[0,0,1,1]);
t5 = uitab(tg2, 'Title', 'Tab 5');
t6 = uitab(tg2, 'Title', 'Tab 6');
t1.Scrollable = "on";
t2.Scrollable = "on";

Answers (1)

Voss
Voss on 15 Apr 2024
It seems like having AutoResizeChildren set to 'on' (which is the default) conflicts with positioning children whose Units are 'normalized'. To work around that and have the normalized positions respected, set AutoResizeChildren to 'off' for the uifigure and for the uitabs that contain uitabgroups.
%Creating Tabs
fig = uifigure("Name","BISC",'Units','normalized','Position',[0.1, 0.1, 0.8, 0.8],'AutoResizeChildren','off');
tg = uitabgroup(fig,'Units','normalized',"Position",[0,0,1,1]);
t1 = uitab(tg,"Title","Data",'AutoResizeChildren','off');
tg1 = uitabgroup(t1,'Units','normalized',"Position",[0,0,1,1]);
t3 = uitab(tg1, 'Title', 'Tab 3');
t4 = uitab(tg1, 'Title', 'Tab 4');
t2 = uitab(tg,"Title","Plots",'AutoResizeChildren','off');
tg2 = uitabgroup(t2,'Units','normalized',"Position",[0,0,1,1]);
t5 = uitab(tg2, 'Title', 'Tab 5');
t6 = uitab(tg2, 'Title', 'Tab 6');
  4 Comments
ALEXANDROS
ALEXANDROS on 19 May 2024
R2023b. What if i create a function? I haven't tried it yet, as i am busy with other university responisbilities and exams, but it is a thought i had.

Sign in to comment.

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!