How do I stop MATLAB from changing the focus to a random window after closing a dialog?

Hi,
when I create a simple dialog like:
dialog('name','My Dialog');
and then close it using the "X" an arbitrary other window (not another MATLAB figure, just a random program like outlook) gets the focus.
strange :-S
Any ideas?
Greetings
Jeffrey

 採用された回答

Sean de Wolski
Sean de Wolski 2012 年 8 月 14 日
Hmmm. This seems to happen if the 'WindowStyle' is 'Modal':
figure('windowstyle','modal')
Apparently setting the CloseRequestFcn to delete(src) fixes it:
figure('windowstyle','modal','closerequestfcn',@(src,evt)delete(src))

その他の回答 (2 件)

Jeffrey
Jeffrey 2012 年 8 月 14 日

0 投票

Thank you! that works,
But shouldn't this be the standard? Looks like a bug for me?
Matt Fig
Matt Fig 2012 年 8 月 14 日
I cannot reproduce this. Perhaps if you use the figure command after you call DIALOG you can regain focus where you want. I assume you are calling DIALOG programmatically?
figure(fig_handle)

カテゴリ

ヘルプ センター および File ExchangeTime Series Objects についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by