Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

alexcurtis

macrumors newbie
Original poster
Jun 11, 2010
9
0
Hi,

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

Many Thanks,
-Alex
 
Are you intercepting key events in some way?

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
 
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.