I'm doing a project based on Cocoa. I'm almost done, it's a little project, but I want to know how my application could open the Find window (Command-F) and set the string to search.
Thanks
Thanks
- (void)loadFindStringToPasteboard {
NSPasteboard *pasteboard = [NSPasteboard pasteboardWithName:NSFindPboard];
[pasteboard declareTypes:[NSArray arrayWithObject:NSStringPboardType] owner:nil];
[pasteboard setString:[self findString] forType:NSStringPboardType];
}
- (IBAction) fOpenSourceButtonClicked: (id)sender
{
//get the row selected in the scroll view
int irow = [scrollview selectedRow];
//get the columns of the scroll view
NSArray * aColumns = [scrollview tableColumns];
//get the source path column (index = 1)
NSTableColumn * tcolpath = [aColumns objectAtIndex:1];
//get the selected cell for the source path
// BUG: DOESN'T MATCH WHAT I SEE IN THE TABLEVIEW
NSTextFieldCell * tfcell = [tcolpath dataCellForRow:irow];
//get the source path text
NSString * strPath = [tfcell stringValue];
//get the function name column (index = 0)
NSTableColumn * tcolfuncname = [aColumns objectAtIndex:0];
//get the selected cell for the function name
NSTextFieldCell * tftosearch = [tcolfuncname dataCellForRow:irow];
NSString * strToSearch = [tftosearch stringValue];
}