This code is called when a button is pressed in a modal window. The current window was made modal by using [NSApp runModalForWindow:[self window]] inside -(void)showWindow:(id)sender method.
To open the new window I use the following code. It works ok, but the button that was pressed, stays in a "clicked" state. So probably I'm doing something wrong.
- (IBAction)restoreFrom:(id)sender {
__block RestoreBackupController *restoreController = [[RestoreBackupController alloc]initWithWindowNibName:@"RestoreBackup"];
[restoreController setWindowWillCloseBlock:^{
[restoreController autorelease];
[restoreController.window orderOut:self];
[NSApp runModalForWindow:self.window];
}
];
[NSApp runModalForWindow:restoreController.window];
}
The block gets called by a subclass of NSWindowController when receiving the close message. Thank you.