• 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
[Q] How to add "Find" feature for an NSTextView?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Q] How to add "Find" feature for an NSTextView?


  • Subject: [Q] How to add "Find" feature for an NSTextView?
  • From: JongAm Park <email@hidden>
  • Date: Wed, 09 Jul 2008 15:18:44 -0700

Hello.

I'm trying to write codes that searches a given text in an NSTextView.
Currently, a window has an NSSearchField and an NSTextView. Some text will be loaded into the NSTextView and I expect users type into the NSSearchField to search some words in the NSTextView.


I connected -(IBAction)searchSource:(id)sender to the NSSearchField.

-(IBAction)searchSource:(id)sender
{
   NSString *searchString = [searchField stringValue];
   NSRange stringRange = NSMakeRange(0, [searchString length] );

// xmlSourceView is the NSTextView in which the given string will be searched
[xmlSourceView showFindIndicatorForRange:stringRange];
[xmlSourceView performFindPanelAction:self];
}


According to the document, the performFindPanelAction performs some actions based on its tag.
However, there is no explanation how to set the tag.


Also, I tried "Command-F" to display a Find dialog box, but all of its buttons are disabled.
I thought "Find" feature was automatically enabled without writing any code before, but it doesn't work for me now.


Can anyone help me?

Thank you.

_______________________________________________

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


  • Prev by Date: Spaces API issues
  • Next by Date: Re: Quick look preview multipage rich text
  • Previous by thread: Spaces API issues
  • Next by thread: Nesting IKImageBrowser GroupStyles
  • Index(es):
    • Date
    • Thread