Controling Tabs in App Designer

35 ビュー (過去 30 日間)
Aurélie B
Aurélie B 2021 年 4 月 10 日
コメント済み: Mario Malic 2021 年 4 月 11 日
Hi!
I am currently creating an app with AppDesigner and I am struggling with a problem I can't solve. Here is the situation : I created 2 different tabs in a panel, and depending on the tab I am currently on, I'd like to give a button differents actions to do.
My problem is : I don't know how to implemant the fact that I am in the tab1 or the tab2, and thus, the button doesn't work the way I want.
Thank you for helping!

採用された回答

Mario Malic
Mario Malic 2021 年 4 月 11 日
Hello,
Tabs are children of the TabGroup component. The latter component has property called SelectedTab which will be helpful.
  4 件のコメント
Aurélie B
Aurélie B 2021 年 4 月 11 日
Thank you so much, it works !
Mario Malic
Mario Malic 2021 年 4 月 11 日
By the way, you don't need to create a property nor the callback to use in your calculations, when app gets more and more complex, debugging can be problematic.
It is better to reference the components directly in the calculations.
function calculate(app)
if strcmpi(app.TabGroup.SelectedTab.Title, 'Segmentation')
% do this
else
% do that
end
end

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

その他の回答 (0 件)

カテゴリ

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