uitabgroup with tabs from different .fig files
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Joakim Magnusson
il 14 Giu 2016
Modificato: Joakim Magnusson
il 14 Giu 2016
I have created a GUI with "tabs" with just buttons. When I push a button I just make the current figure invisible and the selected figure visible. I would like to change it and use uitabs in matlab r2015b instead, now to my question. Is it possible to make the tabs in different .fig - files and have the uitabgroup in a main figure? I have made som tries but I can't see how it can be done.
Example
%Create tab group
handles.tgroup = uitabgroup('Parent', handles.figure1,'TabLocation', 'left');
handles.tgroup2 = uitabgroup('Parent', handles.figure1,'TabLocation', 'left');
handles.tab1 = uitab('Parent', handles.tgroup, 'Title', 'My Tab Label 1');
handles.tab2 = uitab('Parent', handles.tgroup, 'Title', 'My Tab Label 2');
handles.tab3 = uitab('Parent', handles.tgroup, 'Title', 'My Tab Label 3');
%Place panels into each tab
set(handles.p1,'Parent',handles.tab1)
set(handles.p2,'Parent',handles.tab2)
set(handles.p3,'Parent',handles.tab3)
%Reposition each panel to same location as panel 1
set(handles.p2,'position',get(handles.p1,'position'));
set(handles.p3,'position',get(handles.p1,'position'));
Something like this but instead make handles.tab2 and handles.tab3 in other .fig files using GUIDE.
0 Commenti
Risposta accettata
Adam
il 14 Giu 2016
Modificato: Adam
il 14 Giu 2016
The problem is that what is defined in a .fig will always be a figure, not a panel that can simply be parented by your tab. A figure cannot be parented by anything.
One thing you could try (I haven't done so I'm not sure if it would work) is to launch your figure (i.e. the one that represent a single tab), making it invisible (you can set 'Visible' to 'off' in GUIDE itself.
Then, assuming everything you want within that .fig is in a panel you could try re-parenting the panel from the .fig to your uitab. This would probably involve some unpleasant use of findall or similar to fish the panel handle out of your invisible figure, but it might work.
I would suggest creating the simplest test case you can to see if this works rather than on your real code. Just create a .fig with a panel in it and some slider or whatever and then create your uitab on command line or in a script and try locating the panel handle from the launched figure and reparenting it.
Personally I tend to do programmatic UIs when I use tabs, but it is a big inconvenience (though GUIDE performance is so bad nowadays it is less of an inconvenience than it might have been!)
1 Commento
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Dialog Boxes in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!