NSTextField CMD-A Select All

Discussion in 'Mac Programming' started by alexcurtis, Jun 15, 2010.

  1. alexcurtis macrumors newbie

    Joined:
    Jun 11, 2010
    #1
    Hi,

    My Cocoa app doesn't accept command-a as select all in a text field. Any thoughts?

    Many Thanks,
    -Alex
     
  2. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
  3. alexcurtis thread starter macrumors newbie

    Joined:
    Jun 11, 2010
    #3
    yes I am:

    Code:
    - (BOOL)control: (NSControl *)control textView:(NSTextView *)textView doCommandBySelector: (SEL)commandSelector 
    however a quick:

    Code:
    NSLog(@"control area = %@",NSStringFromSelector(commandSelector));
    gives a noop. I wasn't sure how to detect if cmd-a was sent.

    I return NO if it doesn't recognise the command, which it currently doesnt for cmd-a. The docs say this indicates that my delegate object doesn't handle the key binding. I would have thought the default select all would have kicked in. Seems it doesnt. I've also noticed on other cocoa projects that the cmd-a select all doesnt work on textfields even when no key binding code has been added.

    Thanks,
    -Alex
     
  4. alexcurtis thread starter macrumors newbie

    Joined:
    Jun 11, 2010
    #4
    Its Ok Guys.

    I needed to create a main menu. Then link select all in first responder to a select all (with cmd-a key binding) in interface builder.
     

Share This Page