2

アプリケーションTabPanel Constructor v2.8を使用しようとしています。私はそれで与えられた指示に従いました。私のGUIの開始fcnで、タブの1つを選択する必要があります。そのためには、前述のアプリケーションに付属する tabselectionfcn を使用する必要があります。この関数には次のシグネチャがあります。

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

タブパネルのハンドルを見つけるために GUI の変数ハンドルを調べても、それらが表示されません。GUI の .fig ファイルを開いても表示されないため、この問題を解決する方法がわかりません。

PD このアプリケーションの作成者に電子メールを送信しましたが、応答がありませんでした。

4

1 に答える 1

2

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');
于 2012-02-22T19:29:07.653 に答える