I have created a custom sheet which has a table in it. The table has list of usernames in it:
I want to get the selected row value and use it in the application. I am able to get the row in the the following way:
-(void)tableViewSelectionDidChange:(NSNotification *)notification{
NSInteger selectedRow = [[notification object] selectedRow];
if(selectedRow != -1){
self.selectedRowDict = [self.usersArray objectAtIndex:selectedRow];
}
}
But now my issue is that I want to pass the data back to the main window which started this sheet.
The following is the code for the same:
if(!self.accountSheet){
[NSBundle loadNibNamed:@"AccountSheet" owner:self];
}
[NSApp beginSheet:self.accountSheet
modalForWindow:[mainWindowView window]
modalDelegate:self
didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:)
contextInfo:NULL];
How to do this?
Please note: The sheet is created in a separate nib from the main window nib. Each nib have their own NSObject extended class to implement the actions and other window related work. the sheet nib is related to the main window as file owner and has a IBOutlet in main nib NSObject class
If any more information is needed please let me know.