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 Ansicht (letzte 30 Tage)
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";

Antworten (1)

Voss
Voss am 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 Kommentare
ALEXANDROS
ALEXANDROS am 19 Mai 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.
Voss
Voss am 19 Mai 2024
Bearbeitet: Voss am 19 Mai 2024
I have just tested the solution in R2023b and confirmed that it works.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by