• 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: NSSearchField and CR
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSSearchField and CR


  • Subject: Re: NSSearchField and CR
  • From: Kyle Sluder <email@hidden>
  • Date: Thu, 31 Oct 2013 08:07:22 -0700

> On Oct 31, 2013, at 6:10 AM, "Gerriet M. Denkmann" <email@hidden> wrote:

>
> I have an NSSearchField with sendsWholeSearchString = NO in order to do incremental searches.
> But if the content of the search field is a regular expression, I only want to process it when the regular expression is complete, i.e. when the user enters CR (aka "return").
>
> Is there a way to distinguish between actionMethod is called because some character was added, or because the user hit CR?

How do you determine whether the user is entering a regex? All plain strings are valid regexes.

I would think the best approach is to offer a checkbox to switch between plain text and regex search. Then the user won't be confused why "hello." matches "hellos", or why search-as-you-type just stopped working in the middle of a string just because they typed some punctuation. In that case, you can just change the sendsWholeSearchString property depending on the search mode.

If you're dead-set on not offering a toggle, you could always ignore regex searches in the action method and implement -control:textView:doCommandBySelector: to process regexes when the field editor gets insertNewline:.

--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


  • Follow-Ups:
    • Re: NSSearchField and CR
      • From: "Gerriet M. Denkmann" <email@hidden>
    • Re: NSSearchField and CR
      • From: Jerry Krinock <email@hidden>
References: 
 >NSSearchField and CR (From: "Gerriet M. Denkmann" <email@hidden>)

  • Prev by Date: 10.9 Bug in Core Data : Entity Description methods
  • Next by Date: Re: Superimposing NSViews over an SKView
  • Previous by thread: NSSearchField and CR
  • Next by thread: Re: NSSearchField and CR
  • Index(es):
    • Date
    • Thread