Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to handle assertion failure on NSButton lockFocus when using modalWindow on quit?
    primarykey
    data
    text
    <p>a button's <code>IBAction</code> in <strong>windowA</strong> calls <code>runModalForWindow:windowB</code>.</p> <p><strong>windowB</strong> becomes key and modal.</p> <p><strong>windowB</strong> has a popUpWindowDatePicker which calls <code>stopModal</code> upon display, and then popUpWindowDatePicker becomes key, and <strong>windowB</strong> resigns key and is not modal. no window is modal at this point.</p> <p>when popUpWindowDatePicker is dismissed, its <code>didResignFirstResponder</code> method sets a boolean to YES. <strong>windowB</strong> then becomes key, and <strong>windowB</strong>'s windowController <code>windowDidBecomeKeyNotification</code> fires, checks the boolean value and if it is YES calls <code>runModalForWindow:self.window</code>.</p> <p>now <strong>windowB</strong> is modal and key. <strong>windowA</strong> is still open, but not key.</p> <p><strong>windowB</strong> has Okay and Cancel buttons which call: <code>[NSApp stopModalWithCode:returnCode]</code> and then <code>orderOut:</code> and <code>close</code> on <strong>windowB</strong>.</p> <p>if the popUpWindowDatePicker is used, and <em>then</em> any time after that <strong>windowB</strong> is closed with Okay or Cancel, an Assertion Failure is called involving the Okay or Cancel buttons:</p> <pre><code>*** Assertion failure in -[NSButton lockFocus], /SourceCache/AppKit/AppKit-1038.29/AppKit.subproj/NSView.m:5237 -[NSButton(0x20021cd60) lockFocus] failed with window=0x20021c0c0, windowNumber=-1, [self isHiddenOrHasHiddenAncestor]=0 </code></pre> <p>if <strong>windowB</strong> is closed with Okay or Cancel and popUpWindowDatePicker has not been used, there is no assertion failure.</p> <p>it seems that the sequence <code>runModal-stopModal-runModal-stopModal</code> on <strong>windowB</strong> is involved in the failure of lockFocus on the button pressed, but i can't find a way to trace down more than this to solve this problem.</p> <p>can anyone offer any hints or thoughts?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload