How do I make a system to add and delete tabs in a GUI with App Designer?

27 ビュー (過去 30 日間)
Thomas McGuigan
Thomas McGuigan 2022 年 11 月 16 日
回答済み: Mohammad Sami 2022 年 11 月 16 日
I am trying to add a tab system to my GUI where a menu button will allow you to add new tabs. Deleting tabs is simple with the delete() function, I can't figure out how to add buttons. I used the following callback to try to add them, but I get the error "Unrecognized property 'new_tab' for class 'tab_test'."
function AddTabMenuSelected(app, event)
app.new_tab = uitab(app.TabGroup);
app.new_tab.Title = "New tab";
end
I have been building this with App Designer using callbacks.
Does anyone know how to go about implementing this, or know if this is even possible?
Thanks!

回答 (1 件)

Mohammad Sami
Mohammad Sami 2022 年 11 月 16 日
This is because in app designer you need to define the property names before you can use them in the code. I would suggest you add the property new_tabs first before calling it in code. You also have issues around managing adding and deleting multiple tabs. While you use new_tabs as a cell array of tabs, you will need to manage how do you keep track of tabs and whether they are deleted.

カテゴリ

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

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by