uitabgroup with tabs from different .fig files
4 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
Adam
2016 年 6 月 14 日
編集済み: Adam
2016 年 6 月 14 日
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 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Dialog Boxes についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!