Panels do not respond to keyboard (NSOpenPanel, NSSavePanel)

  • Hi all,

    there's an extremely mysterious issue bugging me and I can't seem to
    find the  cause for it: When running NSOpenPanel or NSSavePanel (or any
    other sheet or panel, e.g. a print dialog), it works nicely, except the
    panels don't accept keyboard input. All I get is a "DONK!" and the input
    field loses focus. This makes entering filenames impossible.

    Pushing #runModal to the main thread didn't help.

    Am I missing something?  Is my NSApp blocking the keyboard events from
    the panel? Isn't the panel receiving its keyboard input independently?

    The NSApp needs to intercept and handle keyboard events in a rather
    non-standard way (its a ported application). Hence, I assume the issue
    must be related to this. How can I (temporarily) tell the application to
    pass-through keyboard events to the sheet/panel? Is there perhaps a
    possibility to provide the panel with an independent keyboard responder?

    Any hint is appreciated.

    Cheers
    Andre
  • A few days ago I had a question about panels blocking keyboard input. I
    admit the question was probably a bit misleading and unfocussed. Hence
    I'd like to ask again, more focussed this time:

    Any ideas why an NSOpenPanel/NSSavePanel rejects keyboard input? The
    "donk!" clearly indicates there is no responder found. But why? Isn't
    the panel a responder on its own?

    panel = [NSOpenPanel openPanel];
    [panel setAllowsMultipleSelection: NO];
    [panel setCanChooseDirectories: NO];
    [panel setCanChooseFiles: YES];
    [panel setResolvesAliases: YES];

    if  ( [panel runModalForTypes: [NSArray arrayWithObject: @"html"]] ==
    NSOKButton )
            filename = [panel filename];

    The above code is run on the main thread, but to no avail.

    If someone could point me to any direction, that'd be extremely helpful.
    Thanks.

    Andre
  • On Oct 19, 2007, at 12:23 AM, Andre Schnoor wrote:

    > A few days ago I had a question about panels blocking keyboard
    > input. I admit the question was probably a bit misleading and
    > unfocussed. Hence I'd like to ask again, more focussed this time:
    >
    > Any ideas why an NSOpenPanel/NSSavePanel rejects keyboard input? The
    > "donk!" clearly indicates there is no responder found. But why?
    > Isn't the panel a responder on its own?
    >
    > panel = [NSOpenPanel openPanel];
    > [panel setAllowsMultipleSelection: NO];
    > [panel setCanChooseDirectories: NO];
    > [panel setCanChooseFiles: YES];
    > [panel setResolvesAliases: YES];
    >
    > if  ( [panel runModalForTypes: [NSArray arrayWithObject: @"html"]]
    > == NSOKButton )
    > filename = [panel filename];
    >
    > The above code is run on the main thread, but to no avail.
    >
    > If someone could point me to any direction, that'd be extremely
    > helpful.
    > Thanks.

    Run it under gdb, and break on all keyDowns:

    'b keyDown:'
    (choose all)

    ...then....go from there.

    --corbin
  • On Fri, 19 Oct 2007 09:23:43 +0200, Andre Schnoor <andre.schnoor...>
    said:
    > A few days ago I had a question about panels blocking keyboard input. I
    > admit the question was probably a bit misleading and unfocussed. Hence
    > I'd like to ask again, more focussed this time:
    >
    > Any ideas why an NSOpenPanel/NSSavePanel rejects keyboard input? The
    > "donk!" clearly indicates there is no responder found. But why? Isn't
    > the panel a responder on its own?
    >
    > panel = [NSOpenPanel openPanel];
    > [panel setAllowsMultipleSelection: NO];
    > [panel setCanChooseDirectories: NO];
    > [panel setCanChooseFiles: YES];
    > [panel setResolvesAliases: YES];
    >
    > if  ( [panel runModalForTypes: [NSArray arrayWithObject: @"html"]] ==
    > NSOKButton )
    > filename = [panel filename];
    >
    > The above code is run on the main thread, but to no avail.

    What keys are you pressing that it is "donking" on?

    m.

    --
    matt neuburg, phd = <matt...>, <http://www.tidbits.com/matt/>
    A fool + a tool + an autorelease pool = cool!
    One of the 2007 MacTech Top 25: <http://tinyurl.com/2rh4pf>
    AppleScript: the Definitive Guide - Second Edition!
    <http://www.amazon.com/gp/product/0596102119>
previous month october 2007 next month
MTWTFSS
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        
Go to today