Re: DeleteKey problem
Re: DeleteKey problem
- Subject: Re: DeleteKey problem
- From: Ross Carter <email@hidden>
- Date: Thu, 19 Feb 2009 12:00:24 -0500
On Feb 18, 2009, at 12:24 PM, Arun wrote:
I am attaching a small App code with this mail.
This app when run will display a Text cell and a button.
Upon hitting the button, text cell is populated with text "DeleteKey
Pressed".
Also for a button i have added a keyboard equivalent as "Delete" key.
The problem now i have is if i am editing some text in text cell,
and wants
to delete some characters entered using delete key from key board,
i am unable to achieve the expected result.
Instead it is populating the TextCell with "DeleteKy Pressed".
Any idea why this is behaving like this? is there any thing that i
am doing
wrong?
First, let's call it a NSTextField instead of text cell.
You cannot expect the button to do one thing when it is clicked and do
something else when it is fired by typing its keyboard equivalent.
You have connected the button's action method to your app controller.
When the button is clicked, or when its keyboard equivalent is typed,
it is going to send the message "delete:" to your app controller, and
your app controller is going to fire your delete: method, which you
have coded to replace the text contents with "DeleteKey pressed."
Possibly I don't understand what you mean. The delete key does in fact
delete characters in your text field as it should. Command-delete,
which is your key equivalent for the button, emulates a click on the
button as it should.
If you are trying to send a delete: message to the NSTextField, then
you need to read up on the field editor.
Ross
_______________________________________________
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