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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to