Note that there are some explanatory texts on larger screens.

plurals
  1. PONSClosableWindowMask dialog acting strange
    primarykey
    data
    text
    <p>I have a Safari browser plugin, and in it, I want to open an NSWindow to display a copyright note. While the Ok button in the dialog closes the dialog's window, and works perfectly, when I click on the red close window "x" in the top left corner, it also closes the window, but it's parent window (the entire browser tab, I had the plugin running in), remains disabled, as if still a modal window was open somewhere.</p> <p>I even tried to attach a new selector to the window close notification, which runs the same code as the Ok button, but still, it's not working properly.</p> <p>Here is the relevant part of the code:</p> <pre><code>- (void) closeBox { // called when the Ok button pressed [NSApp abortModal]; } - (void)closeClicked:(NSNotification *)notification { // called when the close window 'x' button pressed NSLog(@"Closed"); [NSApp abortModal]; } - (void) openBox { NSRect frame = NSMakeRect(0, 0, 300, 250); mwin = [[[NSWindow alloc] initWithContentRect:frame styleMask:NSClosableWindowMask |NSTitledWindowMask backing:NSBackingStoreBuffered defer:NO] autorelease]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(closeClicked:) name:NSWindowWillCloseNotification object:mwin]; NSButton * bn; bn = [[[NSButton alloc] initWithFrame:NSMakeRect(10, 10, 100, 20) ] autorelease]; [bn setButtonType:NSMomentaryPushInButton]; [bn setTitle:@"Ok"]; [bn setTarget:self]; [bn setAction:@selector(closeBox)]; [[mwin contentView] addSubview:bn]; [NSApp runModalForWindow:mwin]; } </code></pre>
    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.
    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