Control display state of Tabs in a second app with UI?
조회 수: 1 (최근 30일)
이전 댓글 표시
Hey guys,
I have a decent amount of experience with matlab, having worked with it in previous years but this is my first time using Matlab Apps, so I apologize if this might be trivial. I've tried searching and while I have found related topics, I'm having trouble implementing them with any success.
Basically what I'm trying to do is to pass a public parameter from "app1" to control the display state of tabs in "app2". In app1, I am using checkboxes to do this and have created callbacks for each of these, assigning a variable to that value and made each of these a public parameter that should be getting shared with app2.
Within app2, I have two tab groups. "TabGroup" is visible, and "TapGroup2" is not visible. I am attempting to write conditional statements such that if the value of a given checkbox is zero, it sends the tab of interest to TapGroup2 in the hope that it won't be displayed
Within App1, I have a public property setup which is linked to the callback variable defining the value of the checkbox:
properties (Access = public)
SE % value of checkbox to passthru to app2
end
% Value changed function: SafeEndsCheckBox
function SafeEndsCheckBoxValueChanged(app, event)
SE = app.SafeEndsCheckBox.Value;
end
Then within App2, I am attempting to do something like this:
% Selection change function: TabGroup
function TabGroupSelectionChanged(app, event)
if SE==0;
app.tabname.Parent = app.TabGroup2;
end
end
where "tabname" is the handle of the particular tab I'm trying to control the display state of.
I guess my main question is where in app2 should I be creating the callback to accomplish this? Is there anything else I need to do to verify that the public parameter is being passed to app2 from app1?
Thanks for any assistance.
댓글 수: 0
답변 (1개)
Deep
2023년 7월 8일
This article covers well on how you can share data b/w multiwindow apps that can run together at the same time. In your case, app2 can store the handle to app1, and then later check app1.SE in the TabGroupSelectionChanged function.
You will have to make some decisions on the startup of your applications, as passing startup arguments is the suggested way to establish a relationship and share states between 2 apps. The only other ways that I can think of are global variables or a shared file, which you probably want to avoid and should avoid.
참고 항목
카테고리
Help Center 및 File Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!