For some reason, an NSTextField isn't allowing me to paste anything into it using Command+V
, though I can paste into it if I right-click and click 'Paste'. Why is this happening and how do I fix it?
views:
259answers:
3
+1
A:
What happens when you select "Edit > Paste" from your application's main menu?
Darren
2010-01-13 07:57:33
My application sits in the menu bar, it doesn't have a main menu. Could that be the reason? If so, how do I fix it?
Chetan
2010-01-13 08:34:12
Yes, you need something map your keyboard commands to actions (like paste:), and to map the actions to the First Responder. Setting up a menu is the easiest way to do that. Even if you app's Dock icon and menu bar are hidden, you main menu will still receive keyboard commands.
Darren
2010-01-13 08:51:47
I made a main menu for my application now, but now when I click "Edit", the "Paste" button and all others are grayed out even why my cursor is in a text field. How do I fix this?
Chetan
2010-01-14 06:51:47
Chetan: You need to hook up the menu items to First Responder.
Peter Hosey
2010-01-16 05:21:16
A:
Did you:
- Assign a key equivalent to any of your controls (NSButtons, NSMenuItems, ...) that are responding before the Main Menu
-- or --
- Delete the whole Menu
- the Edit NSMenuItem
- the Paste NSMenuItem The "Paste" Shortcut is a key equivalent of the "Paste" NSMenuItem
weichsel
2010-01-13 08:37:42
A:
I fixed it by linking the "Paste" button in my NSMenu Main Menu to the First Responder's paste:
command.
Chetan
2010-01-14 06:58:12
That's a menu item (NSMenuItem), not a button (NSButton), and an action message selector, not a command (HICommand).
Peter Hosey
2010-01-16 05:21:57