Any help would be great. I should add that I'm new to cocoa.
I currently check if I'm on Lion or Snow Leopard (by checking if the class NSTextFinder exists or not) and then set the find panel
[myTextView setUsesFindPanel:YES];
or the bar
[myTextView setUsesFindBar:YES];
Then in the delegate functions attached to Find and Find and Replace menu options, I simply call
-(IBAction)find:(id)sender {
[myTextView performFindPanelAction:sender];
}
-(IBAction)findAndReplace:(id)sender {
[myTextView performFindPanelAction:sender];
}
This works (at least on SL) i.e., displays the find and replace panel. The find next and the find previous do work from the panel itself via its buttons.
What I'd like to do is connect the menu options with find next/previous (via the usual Cmd-G and Shift-Cmd-G) without invoking the panel (as per the usual behaviour). I don't seem to be able to find a way to do that in my functions
-(IBAction)findNext:(id)sender {
}
-(IBAction)findPrevious:(id)sender {
}
An additional question: will the same code work for Lion's find bar?
Thanks in advance.
精彩评论