I’ve a method triggered when a NSTextField looses focus. This method displays a popup sheet over my current window.
Everything works great except when I’ve typed something in the text field and successively I close the window by clicking on the close button. In this case:
- the text field loses focus and the method is triggered and it shows the popup
but
- the window is dismissed anyway, because I’ve clicked the Close button, so the popup is visible only for few seconds.
Thanks
You should create an
NSWindowDelegateand implement-windowShouldClose:to returnNOif the popup is visible or if the text field was the previous first responder (or however else you’re determining that the text field lost focus).