Create sub-tabs inside main tabs ('Parent' property problem)
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Adam
le 22 Fév 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 commentaire
Voir également
Catégories
En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!