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";
0 个评论
回答(1 个)
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!