How to programmatically select a tab in a uitabgroup?

51 次查看(过去 30 天)
Is it possible to programmatically select one of the tabs in a uitabgroup? In response to a user request, I need to recreate the tabs and their contents, but I'd like to keep the original choice of tab. When the tabs are created, tab 1 is always selected.
tabgroup.SelectedTab is a read-only property; I tried writing to it (on the chance that it would work) and nothing happened.
Thanks!

采纳的回答

Sean de Wolski
Sean de Wolski 2014-12-10
You can set it using SelectedTab of the uitabgroup:
tg = uitabgroup;
tt(1) = uitab('Parent',tg);
tt(2) = uitab('Parent',tg);
tt(3) = uitab('Parent',tg);
tg.SelectedTab = tt(2);
(R2014b)
  2 个评论
Gary
Gary 2014-12-10
编辑:Gary 2014-12-10
You're quite right. That's exactly what I tried before, but looks like I made a typographical error. So in spite of the documented read-only status of the SelectedTab property, this does work.
Thanks.
Sean de Wolski
Sean de Wolski 2014-12-10
You're welcome!
Yes, it needs to be set to the tab, not the number
tg.SelectedTab = 2
Would not work.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by