Matlab TabPanel的使用

发布于 2025-01-08 07:30:03 字数 751 浏览 1 评论 0原文

我正在尝试使用应用程序 TabPanel Constructor v2.8< /a>.我已按照它提供的说明进行操作。在我的 gui 的 openingfcn 中,我需要选择其中一个选项卡。为此,我应该使用 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 我向该应用程序的作者发送了一封电子邮件,但没有得到答复。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

樱花坊 2025-01-15 07:30:03

您不需要 tabpanel 句柄,而是需要图形句柄。

GUIDE 创建的图窗的句柄默认是隐藏的。其可见性由 figure 属性 HandleVisibility,它被设置为 GUI 的回调,以保护它们免受命令行用户的影响。该句柄在回调函数内部可见,就像

yourgui_OpeningFcn(hObject, eventdata, handles, varargin)

hObject 是您需要的句柄一样。您可以在与Fig 文件关联的m 文件中找到所有回调函数。

您还可以从 GUI 外部打开 Fig 文件获取句柄,

fh = openfig('yourgui.fig');

或者您可以使用 FINDALL 通过其属性查找对象(包括隐藏对象):

fh = findall(0,'type','figure'); %# all open figures including GUIs
fh = findall(0,'name','yourgui'); %# find by name

然后您可以使用 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)

tabpanel 标签名称是您用作静态文本对象的 Tag 属性创建时的占位符选项卡面板。如果您在 GUIDE 中打开 GUI 并使用属性检查器检查选项卡面板属性,则可以找到它。这看起来像TBP_myTab

顺便说一句,如果您确实需要选项卡面板句柄,您也可以使用 FINDALL 获取它们:

htab = findall(fh,'tag','TBP_myTab');

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');
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文