开发者

close event NSWindow

开发者 https://www.devze.com 2023-02-13 12:06 出处:网络
I have an application, where a second NSWindow is opened by pressing a button. This new window is opened using [NSApp runModalForWindow:<myWindow&开发者_如何学JAVAgt;]. I want to be able to determi

I have an application, where a second NSWindow is opened by pressing a button. This new window is opened using [NSApp runModalForWindow:<myWindow&开发者_如何学JAVAgt;]. I want to be able to determine if the user closes the second window, in order to stop the modal.


There are several ways to be notified when a window closes.

  • You can observe NSWindowWillCloseNotification notifications from the second NSWindow object.
  • You can implement NSWindowDelegate methods windowShouldClose: or windowWillClose:.
  • You can subclass NSWindow and override the performClose: method.
  • You can add a Close button to the window, and connect it to an action.

Without more information, it's hard to advise which of these or other options would work best for you.

0

精彩评论

暂无评论...
验证码 换一张
取 消