フィルターのクリア

Create a new tab (window) in app designer while still having the old tab open

84 ビュー (過去 30 日間)
Hi,
I have an app designer app that plots data sets and can overlay lines and distributions on the plot. It can do this for many different data sets.
I'm wondering if there is a way to open a new tab (like in a browser) so that I can start plotting other data sets from scratch while still having the other plot open in an old tab?
Clearing the plot is not what I want to do. I need the older plot to still be there.
I have researched the idea and found a solution to have the 'new tab' button open another instance of the app designer app (App Designer: How to open a second GUI or a new window with panels, lamps, edit fields, etc. by a ButtonPush callback ? - (mathworks.com)) however I would rather have everything in the same window and the 'new tab' button open a new tab using the tab group container built into app designer.
I hope this question makes sense, and I'd really appreciate any advice or help on the issue.
Andrew
  2 件のコメント
Monica Roberts
Monica Roberts 2022 年 7 月 14 日
You can use the uitab function to add a uitab into your tab panel:
You'll then have to manually create the elements you want in that tab. Instead of dragging and dropping the ui elements from the library, you can use the command-line functions. E.G.
t = uitab(app.TabGroup);
uia = uiaxes(t);
plot(uia,x,y)
Andrew Feenan
Andrew Feenan 2022 年 7 月 14 日
Thank you for your response. I have a button setup to open a new tab now
uitab(app.DistributionFitterTabGroup,'Title',['Tab ' num2str(app.tabNum)]);
app.tabNum = app.tabNum + 1;
if app.tabNum > 2
app.CloseTabButton.Enable = "on";
else
app.CloseTabButton.Enable = "off";
end
As you mentioned above, I will have to manually create all the elements in the new tab but is there a way to copy all the elements in tab 1 to tab two when tab 2 is created?

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

採用された回答

Mario Malic
Mario Malic 2022 年 7 月 14 日
編集済み: Mario Malic 2022 年 7 月 18 日
Hey,
you can create a button that will add a new tab.
t = uitab(parent,Name,Value);
Where parent is the handle to the existing uitabgroup component you want to add the tab to.
If you would like to copy all the callbacks and other objects, try with function copyobj. I have never tested it, but it probably should work. Otherwise, you can set up the whole graphic object and wrap it up in a function.
  2 件のコメント
Mario Malic
Mario Malic 2022 年 7 月 18 日
Updated my reply w.r.t. your comment.
Andrew Feenan
Andrew Feenan 2022 年 7 月 18 日
Thank you!

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

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by