0

I'm trying to determine when an NSOpenPanel is closing before it actually closes. I need to do this so I can overlay another window with a screenshot of the open panel on top of it to be animated. Unfortunately, all the notifications that you seem to be able to access seem to fire AFTER the window's already been closed. This leads to a jarring stutter before you start your transition.

I've tried:
- using NSWindow delegate methods on the open panel (apparently, none of the NSWindow delegate methods work)
- monitoring panel:userEnteredFilename:confirmed: (not called)
- showing the dialog with a callback (callback happens AFTER the panel disappears)

4

2 回答 2

1

您应该将您的控制器注册为打开面板的委托,然后实现-panel:isValidFilename:委托方法。此方法将在打开的对话框关闭之前调用。

YES如果您只想要通知,则应该从该方法返回。ReturningNO允许您防止打开的对话框被关闭。

于 2010-03-18T02:43:24.763 回答
0

处理这个问题的另一种方法是查看 NSOpenPanel 的子视图中的取消按钮,然后将自己作为目标/动作交换。这就是我最终做的。

于 2010-05-20T18:48:59.573 回答