cocoansopenpanelnspathcontrol

Cocoa: NSPathControl NSOpenPanel, get notification when user clicked OK


I have a NSPathControll set up in IB and I use this method when I set up the NSOpenPanel:

-(void)pathControl:(NSPathControl *)pathControl willDisplayOpenPanel:(NSOpenPanel *)openPanel
{
    [openPanel setDelegate:self];
    [openPanel setCanChooseDirectories:YES];
    [openPanel setCanCreateDirectories:YES];
    [openPanel setCanChooseFiles:NO];
    [openPanel setPrompt:@"Choose"];
}

I would like to know when the user clicked the OK-button (in this case the 'Choose'-button).

If I use -(void)panel:(id)sender directoryDidChange:(NSString *)path I only get notified when the user double clicked on a folder.

Any ideas?

Thanks in advance!


Solution

  • I solved it by using:

    -(BOOL)panel:(id)sender isValidFilename:(NSString *)filename
    

    I was looking for a "panel:(id)sender didClose" or something similar.

    /M