I am trying to use the application TabPanel Constructor v2.8. I have followed the instructions given with it. In the openingfcn of my gui I need to select one of the tabs. For it, I should use the tabselectionfcn which is adjunct with the mentioned application. This function has the following signature:
TABSELECTIONFCN(<hFig>,<TabTag>,<tabnumber>)
% <hFig> the handle(!) of the Figure (which contains the tabpanel)
% and not the name of the figure file.
% <TabTag> the Tag name of the tabpanel
% <tabnumber> The number of the tabpanel or the tab string
When I research for the variable handles of my gui to find handles of the tabpanels, I do not see them. If I open the .fig file of my gui they do not appear, so I do not know what to do to overcome this problem.
P.D. I sent an email to the author of this application but I did not get answer.
You don't need tabpanel handle, but figure handle.
The handle for figure created by GUIDE is hidde by default. Its visibility is controlled by figure property HandleVisibility
, which is set to callback
for GUI to protect them from command line user. The handle is visible from inside the callback function, like
yourgui_OpeningFcn(hObject, eventdata, handles, varargin)
where hObject
is the handle you need. You can find all callback functions in the m-file associated with the fig-file.
You can also get the handle from outside the GUI opening the FIG file as
fh = openfig('yourgui.fig');
Alternatively you can use FINDALL to find an object (including hidden) by its properties:
fh = findall(0,'type','figure'); %# all open figures including GUIs
fh = findall(0,'name','yourgui'); %# find by name
Then you can control a tab with TABSELECTIONFCN:
tabselectionfcn(fh,'myTab') %# get the tab status
tabselectionfcn(fh,'myTab',2) %# activate the 2nd tab
tabselectionfcn(fh,'myTab',1,'off') %# disable the 1nd tab (if not active)
The tabpanel Tag name is the Tag
property of the static text object you used as a placeholder while creating the tabpanel. You can find it if you open your GUI in GUIDE and inspect the tabpanel properties with Property Inspector. That will look like TBP_myTab
.
By the way, if you do need tabpanels handle you can get them also with FINDALL:
htab = findall(fh,'tag','TBP_myTab');