Filter löschen
Filter löschen

how close external window in app designer?

14 Ansichten (letzte 30 Tage)
Vincenzo Bianco
Vincenzo Bianco am 1 Mai 2019
I have two windows in app designer. "window1" create "window2".
I want to close all window with a button in window1. If i use "close all" or "close all force", it does not work.
  2 Kommentare
Walter Roberson
Walter Roberson am 1 Mai 2019
You mentioned external. Was the second window created by outside software such as Word or Fortnite?
Vincenzo Bianco
Vincenzo Bianco am 2 Mai 2019
no. it's created inside the execution of window1.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Stephane Dauvillier
Stephane Dauvillier am 1 Mai 2019
close instruction will only close figure
If you have created your windows1 (I suppose it's an app) like this
hWin1 = windows1 ;
Then you should be able to delete it with
delete(hWin1)
  2 Kommentare
Vincenzo Bianco
Vincenzo Bianco am 2 Mai 2019
it does not work. window1 and window2 are both .mlapp files.
I have an error: "Undefined function or variable hWin1"
Stephane Dauvillier
Stephane Dauvillier am 2 Mai 2019
if hWin1 doesn't exist it will not work.
I suppose, you're not in the same workspace between the call of this
hWin1 = windows1 ;
And the call of this
delete(hWin1)
Otherwise, you wouldn't have this error message.
What you have to do is pass the variable hWin1
Without any other knowledge of your code it's pure guess.
So, what I'm guessing is your main app open other app. Then during this opening you have to assign the output of windows1 to a property of your main app.
By doing so, you will be able to delete this "sub app" when appropriate.
You can add properties in your main app named
mySubApps
In the initialization methods of your app you have to initialize this new property
function myInitiazeFunction(app)
app.mySubApps = [] ;
% put the rest of your initialization
end
Then In the methods where your main app open windows1
function myWhatever(app,someOtherParameter)
hWin1 = windows1 ;
app.mySubApps = [app.mySubApps;hwin1];
end
Do the same thing for every "sub app"
An then in the methodyou want your main app to close your sub app:
function deleteSubApps(app,someOtherParameters)
delete(app.mySubApps)
end

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

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

Community Treasure Hunt

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

Start Hunting!

Translated by