Just wondering: did you consider using NSDocument? Depending on what you're
doing it may be more appropriate than NSSavePanel.

Regarding your problem, I have no idea, but the issue might be that you're
passing NULL (a.k.a. nil) as the directory. I'd try passing
NSHomeDirectory() before anything else.

Also, try checking if [NSApp mainWindow]; works ok. It could maybe still be
nil (again, depending on what you're doing).
http://lists.apple.com/archives/cocoa-dev/2002/Jul/msg00022.html

These are just ideas and starting points of where I'd start my exploration.

On Wed, Mar 23, 2011 at 21:08, Stefan Bidi <[email protected]> wrote:

> I've never had to use an NSSavePanel before so this is completely new to
> me.  I took a look at the Apple documentation for it and also an example
> they have.  Whenever I run the following code the button gets sunk in and
> highlighted (and stays that way) but the panel never shows up.  Can anyone
> point me in the correct direction?  I have no idea if any of what I have
> here actually works.  In a nutshell, I want to save the data in a
> NSTableView to a csv file.
>
> - (void) save: (id)sender
> {
>   NSSavePanel *panel = [NSSavePanel savePanel];
>
>   [panel setAllowsOtherFileTypes: NO];
>   [panel setAllowedFileTypes: [NSArray arrayWithObject: @"csv"]];
>   [panel beginSheetForDirectory: NULL
>                            file: @"output.csv"
>                  modalForWindow: [NSApp mainWindow]
>                   modalDelegate: self
>                  didEndSelector:
> @selector(savePanelDidEnd:returnCode:info:)
>                     contextInfo: nil];
> }
>
> Thanks
>
> _______________________________________________
> Discuss-gnustep mailing list
> [email protected]
> http://lists.gnu.org/mailman/listinfo/discuss-gnustep
>
>


-- 
Regards,

Ivan Vučica
_______________________________________________
Discuss-gnustep mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/discuss-gnustep

Reply via email to