• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: 10.5 Only: If I say NO, NSOutlineView ignores cmd key, does its own thing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 10.5 Only: If I say NO, NSOutlineView ignores cmd key, does its own thing


  • Subject: Re: 10.5 Only: If I say NO, NSOutlineView ignores cmd key, does its own thing
  • From: Jerry Krinock <email@hidden>
  • Date: Wed, 4 Jun 2008 19:29:11 -0700


On 2008 Jun, 04, at 16:39, Corbin Dunn wrote:

It sounds like you think it is incorrect to have NSTableView handle cmd-up/down like plain up/down. Please log a bug for this; I'll consider changing it.

No, I was just asking. I don't have any religion on this. However,

It doesn't stop doing stuff if cmd is down; in fact, it never has.

I just filed a documentation "wasn't helpful" on the behavior of NSTableView keyboard equivalents/keyDowns/whatever being undocumented [1].


You can work around it by overriding -keyDown: in a nstableview subclass and not calling super if it is cmd + (up/down).

My Business Manager says that your workaround [2] is good enough. And faster :)


Thank you, Corbin.  Case closed.

Jerry


[1] http://developer.apple.com/documentation/Cocoa/Conceptual/TableView/Concepts/AboutTables.html#/ /apple_ref/doc/uid/20000115-CJBCADCE


The document is missing information.

This documentation does not state what keyboard equivalents or other keystrokes execute what actions in NSTableView. For example, the up/ down arrow keys move the selection. "Everyone" knows that, of course, but what if you hold down the cmd key while hitting up/down arrow key? The answer is that the same thing happens, but not everyone knows that, and cannot know without running an experiment on an app that is known to not implement its own key equivalent for this. It is necessary to know this when designing applications that seek to use these keystrokes for their own actions, particularly in Leopard since disabled key equivalents in NSMenu are now "passed through"; see http://developer.apple.com/releasenotes/Cocoa/AppKit.html#NSMenu . Without knowing this, the same keystroke can result in different actions if the first action in the chain is disabled.

[2]
- (void)keyDown:(NSEvent*)event {
    NSString *s = [event charactersIgnoringModifiers] ;
    unichar keyChar = 0 ;
    BOOL didDo = NO ;
    if ([s length] == 1) {
        ...
        // handle other keys as desired, set didDo if did do
        ...
    }

    int unsigned modifierFlags = [[NSApp currentEvent] modifierFlags] ;
    BOOL cmdKeyDown = (modifierFlags & NSCommandKeyMask) > 0 ;
    if (!didDo && !cmdKeyDown) {
        [super keyDown:event] ;
    }
    else if (cmdKeyDown) {
        NSBeep() ;
    }
}

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >10.5 Only: If I say NO, NSOutlineView ignores cmd key, does its own thing (From: Jerry Krinock <email@hidden>)
 >Re: 10.5 Only: If I say NO, NSOutlineView ignores cmd key, does its own thing (From: Corbin Dunn <email@hidden>)
 >Re: 10.5 Only: If I say NO, NSOutlineView ignores cmd key, does its own thing (From: Jerry Krinock <email@hidden>)
 >Re: 10.5 Only: If I say NO, NSOutlineView ignores cmd key, does its own thing (From: Corbin Dunn <email@hidden>)

  • Prev by Date: Re: How to implement window fade-in fade-out effects
  • Next by Date: Re: invoking quicklook via code
  • Previous by thread: Re: 10.5 Only: If I say NO, NSOutlineView ignores cmd key, does its own thing
  • Next by thread: totally confused by bindings settings
  • Index(es):
    • Date
    • Thread