Opening/Saving files via Sheets...
Opening/Saving files via Sheets...
- Subject: Opening/Saving files via Sheets...
- From: Steven Canfield <email@hidden>
- Date: Sat, 08 Dec 2001 16:20:52 -0600
#import "myDelagate.h"
@implementation myDelagate
- (IBAction)openPic:(NSWindow *)sender
{
NSArray *fileTypes = [NSArray arrayWithObjects: @"jpg", @"gif", @"tiff"
@"bmp", @"ping", @"pict", @"pdf", @"eps", nil];
NSWindow *myWindow;
myPanel = [NSOpenPanel beginSheetForDirectory:NSHomeDirectory()
file:nil
type:fileTypes
modalForWindow:myWindow
modalDelegate:self
didEndSelector:@selector(openPanelDidEnd:returnCode:contextInfo:)
contextInfo:sender];
return FALSE;
}
- (void)openPanelDidEnd:(NSOpenPanel *)sheet returnCode:(int)returnCode
contextInfo:(void *)contextInfo{
{
NSArray *myArray;
if(returnCode == NSOKButton)
myArray = [myPanel filenames];
}
}
Ok, lets talk about this..
MyDelagate is just a NSObject, which I'm trying to use to control my window.
First of all, when I press the button "openPic" is hooked up to, I get this:
"2001-12-08 15:57:14.298 Nimage[744] *** +[NSOpenPanel
beginSheetForDirectory:file:type:modalForWindow:modalDelegate:didEndSelector
:contextInfo:]: selector not recognized"
(If there is one thing I dislike about Project Builder it is this..really
weird errors, that make no sense to me (though most compilers are the same
way))
In any case, I'd be much obliged if someone could help, since I've spent
over 4 hours trying to figure this out (but once I do, oh my, we'll be
set!)
My second question is can someone point me to a site where stuff like this
is covered, with examples? I have been looking at "Learning Cocoa" and
"cocoadevcentral.com" and Apple's site, and trying to piece it together from
the three of them...
Thanks in advance!