Control display state of Tabs in a second app with UI?

1 Ansicht (letzte 30 Tage)
Charles
Charles am 8 Jul. 2023
Kommentiert: Charles am 12 Jul. 2023
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.

Antworten (1)

Deep
Deep am 8 Jul. 2023
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.
  1 Kommentar
Charles
Charles am 12 Jul. 2023
I worked through that example and implemented everything step by step.
Each of my checkboxes has a callback function with a property that is defined and being passed to app2, but I cannot get the display state of the tab to change.
Not really sure where to go from here other than backwards to try and get the simplest example working.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Develop Apps Using App Designer finden Sie in Help Center und File Exchange

Produkte


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by