Re: NSDeleteCharacter when expected NSBackspaceCharacter
Re: NSDeleteCharacter when expected NSBackspaceCharacter
- Subject: Re: NSDeleteCharacter when expected NSBackspaceCharacter
- From: j o a r <email@hidden>
- Date: Mon, 16 May 2005 22:27:41 +0200
On 16 maj 2005, at 21.50, Sean McBride wrote:
Those constant names are very confusing! I've never seen a Mac
keyboard
with a 'backspace' key, but I'm guessing NeXTs did have them.
Anyway, I
think you may be confusing 'keys' and 'characters'.
Possibly, but I'm mostly confused with their names, or lack thereof...
I notice that the following are in NSEvent.h:
NSDeleteFunctionKey, NSDeleteCharFunctionKey, NSDeleteLineFunctionKey
and the following are in NSText.h:
NSBackspaceCharacter, NSDeleteCharacter
I think keys map to chars (and this depends on the user's
keybindings!)
So the key that doesn't have a defined name, the key that I thought
was called "backspace", maps to "NSDeleteCharacter". And the
NSDeleteFunctionKey maps to a character that doesn't have a defined
name, but with the same value as NSDeleteFunctionKey itself. Not
exactly crystal clear... I have working code, but I'm not happy about
it being so much based on trial-and-error.
Maybe your NSTableView subclass can implement deleteBackward: and
deleteForward: instead? I think that would be best. Otherwise testing
chars is probably better than testing raw keys.
It would have been great if that had worked, but I think that these
methods are only called automatically from the text system. It would
have been great to not have to subclass at all, and just implement a
delegate method, something like "control:(textView:)
doCommandBySelector:" (but without the text view of course)!
But I'm not sure about any of this, but no one else replied. :)
I'm grateful for your reply!
j o a r
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden