3

Generally, when editing text in a text field/input/area/editor, pressing ⌘A will select all of the current text in said field/input/area/editor. I've subclassed NSTextField and NSTextFieldCell, and no matter what I try, I can't seem to get basic "Select All" functionality working. I've tried implementing delegate protocols, intercepting events, manipulating commands made by selectors, and every other thing I can think of. What gives? (I can already hear the "Ever heard of Google?" refrains because of how simple this probably is, but I haven't found a single answer out there. I guess I can thank iOS for that.)

And before I forget to mention it, I also dragged a standard NSTextField into my nib to see if a non-subclassed NSTextField implements Select All behavior by default, and to my shock, it doesn't. Am I going crazy here, or am I completely overlooking something? Isn't Select All almost a requirement when implementing a text field? Apple's First Responder proxy handles everything under the sun (including two versions of selectAll (selectAll and selectAll:), but the n00b is strong with me, and I can't seem to make sense of any of this.

Any help/ideas would be immensely appreciated. Cheers!

Ben Stock
  • 1,986
  • 1
  • 22
  • 30

1 Answers1

4

The application menu handles sending the keyboard shortcut actions to the application's current first responder. The missing connection would explain why your regular NSTextField objects are missing this functionality as well.

Connection action in Interface Builder in Xcode 5

Fruity Geek
  • 7,351
  • 1
  • 32
  • 41
  • Thanks for the response! I _have_ altered the default application menu, so I bet you're right. Why I would remove the Select All item is beyond me. Too many hours in front of this bright screen, I guess. I'll create a new Select All menu item, connect some actions, and report back. Thanks, Fruity. – Ben Stock Oct 29 '13 at 21:44
  • 1
    I totally forgot to update this post. @FruityGeek nailed it. I had accidentally removed the "Select All" menu item from the application's MainMenu Nib. All's well that ends well. Cheers. – Ben Stock Nov 06 '13 at 16:08