Re: Dialog Command Keys
Re: Dialog Command Keys
- Subject: Re: Dialog Command Keys
- From: Bill Appleton <email@hidden>
- Date: Tue, 26 Jul 2011 08:09:20 -0700
Whoops yes, command-x
So i create some NSTextFields on the dialog window
(can't use Interface Builder, this is a dynamically created dialog)
And when i right-click in them i get a clever menu with search in google,
convert to uppercase, etc.
There ARE cut, copy, and paste items in this menu, but they DONT have any
command key bindings, maybe that is the problem? i didn't create this menu
in the first place
thx
On Tue, Jul 26, 2011 at 8:00 AM, Kyle Sluder <email@hidden> wrote:
> On Jul 26, 2011, at 7:52 AM, Bill Appleton <email@hidden>
> wrote:
>
>
> BUT my question is that it seems like there ought to be an easy or
> automatic way to do this. If i right-click on a text control i get a pop up
> menu with cut, copy, and other options. That same control isn't smart enough
> to handle the control-X key? It just seems strange, I'm looking for the
> right way to do this & don't want to reinvent the wheel for controls in a
> dialog.
>
>
> First, it's Command-X, not Control-X.
>
> Secondly, the way that key equivalents work is that they're sent to the
> menu bar first. In this case, the Cut menu item on the Edit menu should
> claim the Cmd-X shortcut, and then begin it's -validateMenuItem: process
> down the responder responder chain. Since you're talking about cutting text,
> that means you're using an NSTextField, right? The NSTextField's field
> editor responds to -cut: so -validateMenuItem: will be called on the field
> editor. It should return YES if the field is editable, which will cause the
> menu item to send its action (-cut:) to the field editor.
>
> No custom implementation of -performKeyEquivalent: is required.
>
> So: what happens if you select some text in your text field and bring up
> the Edit menu? Is the Cut item disabled? Does it have the proper shortcut
> listed next to it?
>
> --Kyle Sluder
>
>
_______________________________________________
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