• 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: Modify Input in NSTableView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Modify Input in NSTableView


  • Subject: Re: Modify Input in NSTableView
  • From: Quincey Morris <email@hidden>
  • Date: Mon, 31 Mar 2008 00:29:08 -0700


On Mar 30, 2008, at 23:08, K. Darcy Otto wrote:

I'm working on an application in which users enter data into a table, but I need to substitute a greater-than symbol (>) for a right-arrow symbol (→, unicode: 2192) as the user presses they key (or copies the text, or whatever). After looking at the docs and this list, I'm not much closer to determining the best way to do this (or even how to do it). So far, I have been thinking I have to do something with NSWindow and the fieldEditor; perhaps setting the window's field editor to be a particular NSTextView, and implement some method in that text view (insertText:?) to make the substitution. I take it that working with keyDown: would not be the best approach. Would this be on the right track? Any help would be appreciated.

You could try adding a validate<Key> method for the property that holds the string value. In that method, take the input string and create a new string, replacing whatever characters you need to. Pass the new string back in the first parameter, and return YES from the method.


If I haven't overlooked something obvious, this would work no matter whether the text was typed or pasted into the editing field.

Oh -- make sure you check "Validates immediately" for the table column binding in IB, too.

_______________________________________________

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


  • Follow-Ups:
    • Re: Modify Input in NSTableView
      • From: Quincey Morris <email@hidden>
References: 
 >Modify Input in NSTableView (From: "K. Darcy Otto" <email@hidden>)

  • Prev by Date: NSDictionaryController and inserting new objects.
  • Next by Date: Re: Modify Input in NSTableView
  • Previous by thread: Modify Input in NSTableView
  • Next by thread: Re: Modify Input in NSTableView
  • Index(es):
    • Date
    • Thread