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.

2 次查看(过去 30 天)
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";

回答(1 个)

Voss
Voss 2024-4-15
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 个评论
ALEXANDROS
ALEXANDROS 2024-5-19
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.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by