how close external window in app designer?
14 ビュー (過去 30 日間)
古いコメントを表示
Vincenzo Bianco
2019 年 5 月 1 日
コメント済み: Stephane Dauvillier
2019 年 5 月 2 日
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 件のコメント
Walter Roberson
2019 年 5 月 1 日
You mentioned external. Was the second window created by outside software such as Word or Fortnite?
採用された回答
Stephane Dauvillier
2019 年 5 月 1 日
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 件のコメント
Stephane Dauvillier
2019 年 5 月 2 日
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
その他の回答 (0 件)
参考
カテゴリ
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!