• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: DeleteKey problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >DeleteKey problem (From: Arun <email@hidden>)

  • Prev by Date: How to make nspopupbuttoncell only show litems when click arrow?
  • Next by Date: Re: Adding Multiple NSWindow or NSPanel into another NSWindow
  • Previous by thread: DeleteKey problem
  • Next by thread: iphone landscape problems
  • Index(es):
    • Date
    • Thread