Create sub-tabs inside main tabs ('Parent' property problem)
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I managed to create gui that has variable number of main tabs based on some extracted data from an XML file using this code
if true
% code
Maintabgp = uitabgroup(gcf);
for x = 1: ActNo %create the number of tabs based on some calculations to find ActNo
MainTabs.(['MainTab' num2str(x)]) = uitab(Maintabgp,'Title',['Actuator' num2str(x)]);% For example, if ActNo = 4 then MainTabs: 1x4 cell = [1x1 Tab] [1x1 Tab] [1x1 Tab] [1x1 Tab]
end
And now I want to create 5 sub tabs inside each main tab but I can't assign the 'Parent' of the SubTabgp as illustrated below
if true
% code
Maintabgp = uitabgroup(gcf);
for x = 1: ActNo %create the number of tabs based on some calculations to find ActNo
MainTabs.(['MainTab' num2str(x)]) = uitab(Maintabgp,'Title',['Actuator' num2str(x)]);% For example, if ActNo = 4 then MainTabs: 1x4 cell = [1x1 Tab] [1x1 Tab] [1x1 Tab] [1x1 Tab]
Subtabgp = uitabgroup('Parent','???');
AppSubTab = uitab(Subtabgp,'Title','App','Parent','???');
SpecsSubTab = uitab(Subtabgp,'Title','Specs','Parent','???');
OpSubTab = uitab(Subtabgp,'Title','Op','Parent','???');
TrnsSubTab = uitab(Subtabgp,'Title','Trns','Parent','???');
ActEnrgySubTab = uitab(Subtabgp,'Title','ActEnrgy','Parent','???');
end
Also, the 'Parent' property must be assigned for each sub tab in order to be able to create ui components inside each sub tab, and properly provoke the callback functions.
0 comentarios
Respuestas (1)
Adam
el 22 de Feb. de 2017
You just need to give the parent tab e.g.
AppSubTab = uitab(Subtabgp,'Title','App','Parent', MainTabs.MainTab1 );
If you want an AppSubTab within each of your main tabs you will have to create one for each of them as you can't share one tab between both. Well, you can if you keep reparenting it when you switch tabs - this can be a workable solution, but it depends what is on the tab and whether you need to remember its state on the previous main tab to switch back to etc as to how complicated that is.
1 comentario
Mus'ab Ahmad
el 22 de Feb. de 2017
Editada: Mus'ab Ahmad
el 22 de Feb. de 2017
Ver también
Categorías
Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!