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!