• 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
Highlight Text like with FIne
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Highlight Text like with FIne


  • Subject: Highlight Text like with FIne
  • From: Brad Stone <email@hidden>
  • Date: Sun, 5 Sep 2010 19:33:16 -0400

I want to highlight different substrings contained in controls in a window (two different comboBoxes for example) programmatically when the user is searching for a subString.  I can do this for one comboBox but not both simultaneously.  Here's one.

NSString *s = [titleComboBox stringValue];
NSRange r = [s rangeOfString:searchText options:NSCaseInsensitiveSearch range:NSMakeRange(0, [s length])];
[titleComboBox selectText:w];
if (r.location != NSNotFound) {
// this is needed to select the substring
	NSText *textEditor = [w fieldEditor:YES forObject:titleComboBox];
	[textEditor setSelectedRange:r];
}

But this only highlights the text in the titleComboBox.  If I then repeat this to highlight the  text in the categoryComboBox by repeating the code, titleComboBox gets deselected and categoryComboBox gets selected.  I want to highlight them both simultaneously.  I'd also rather use the big yellow highlight like with the find panel (but that's later).

Is this possible?

Thanks_______________________________________________

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: Highlight Text like with FIne
      • From: Ross Carter <email@hidden>
  • Prev by Date: Re: Fixed pattern with colorWithPatternImage
  • Next by Date: Re: Fixed pattern with colorWithPatternImage
  • Previous by thread: Re: QTMovie Error -2048
  • Next by thread: Re: Highlight Text like with FIne
  • Index(es):
    • Date
    • Thread