App Designer Tab Groups

172 ビュー (過去 30 日間)
April Bryan
April Bryan 2017 年 9 月 8 日
編集済み: Michael 2023 年 11 月 1 日
Hi,
I am trying to make an app with multiple tabs and I am experiencing some difficulty. How do you turn Tabs on and off in app designer? I attempted using the following code:
app.Tab.HandleVisibility='off';
However, nothing happened. The tab still appears when I run the code.
Thanks,
April
  2 件のコメント
Thomas Geise
Thomas Geise 2023 年 2 月 5 日
移動済み: Adam Danz 2023 年 2 月 6 日
Ich it possible to add to an existing app a tabgroup in the way, that the original ap is (unchanged) on the first tab?
Adam Danz
Adam Danz 2023 年 2 月 6 日
I'm not quite sure what you're asking. Consider asking a new question since the topic appears to differ from this thread.

サインインしてコメントする。

採用された回答

Adam Danz
Adam Danz 2020 年 6 月 22 日
An alternative is to keep the tabs visible but prevent the user from selecting them under certain conditions.
This demo uses checkbox values to control whether a tab can be selected or not.
  2 件のコメント
Manuel Alejandro
Manuel Alejandro 2023 年 2 月 24 日
Hi, is it possible to customize the appearence of the tabs, I mean, the heigth and width and the distrubution in the whole tab bar?
Adam Danz
Adam Danz 2023 年 2 月 24 日
The postion property of Tabs is read-only which prevents changing width or height of Tabs. Tab order can be changed but not spacing between tabs.

サインインしてコメントする。

その他の回答 (3 件)

Jorge Paloschi
Jorge Paloschi 2020 年 6 月 5 日
Another way of doing it:
  • Create a dummy
tg = matlab.ui.container.TabGroup;
  • Suppose your tab is in index 2, then do
app.TabGroup.Children(2).Parent = tg;
  • After this the tab is not visible anymore
  • To make it visible again do the opposite
tg.Children(1).Parent = app.TabGroup;
  • The only remaining action is to permute the children of app.TabGroup so that the last Children goes back to index 2, and voila, visible again in the right order!
You might have to change the property name TabGroup to the one in your application if it is not the default Property name.
  6 件のコメント
ClaytonA
ClaytonA 2021 年 4 月 9 日
Thanks.
This is way harder than it should be. Why isn't there a Visibility property?
Michael
Michael 2023 年 11 月 1 日
編集済み: Michael 2023 年 11 月 1 日
^^^ Exactly this - why is it so difficult? Have Enable and Visibility properties for tabs in groups!

サインインしてコメントする。


Melissa Williams
Melissa Williams 2017 年 10 月 16 日
If you want to show and hide the tabs as the user interacts with your app, one way to do this is to add a second TabGroup and set its visibility to off. When you want to hide a tab, set it's parent to the second, hidden tab group, app.Tab.Parent = app.TabGroup2. When you want to show it again, set it back to the visible tab group, app.Tab.Parent = app.TabGroup.
  1 件のコメント
Dominik Müller
Dominik Müller 2020 年 12 月 4 日
Okay this is a way to show / hide tabs. But if I do so and switch between the tabs all items on the tab are hidden. What am I doing wrong? And how to fix this?

サインインしてコメントする。


Elizabeth Reese
Elizabeth Reese 2017 年 9 月 11 日
If you want to change which tab in a group is visible, you can use:
app.TabGroup.SelectedTab = app.Tab1
where Tab1 is a tab in the group.
If you want the entire tab group to disappear from the screen, you can use:
app.TabGroup.Visible = 'off'
  1 件のコメント
April Bryan
April Bryan 2017 年 9 月 11 日
Hi Liz,
Thank for your response. I have two tabs in my program. I tried the following solution to make just one of them visible:
app.TabGroup.Visible='off' app.TabGroup.SelectedTab=app.Tab1
According to the previous response, this should turn both tabs off and then make the first tab visible. However, both tabs remain turned off. The only way I can make them possible is to change app.TabGroup.Visible to 'on'. However, then both tabs appear. Is there a way to fix this?
Thanks
April

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by