I have a NSSavePanel set up for the user to select a file name to store a file. 
The  user can store it in several different formats. I have a NSPopUpButton 
configured to allow the user to select the desired format; upon a change, it 
calls the setRequiredFileType function with that single file type. 

But the panel does not seem to pay attention to any of this, it never displays 
or returns a file name with a file extension. The state of the Show extension 
checkbox does not matter.  I've checked that the popup delegate is getting 
called and setting the required filetype to the string with no dot.

I would implement a bit of the desired functionality myself, but NSSavePanel's 
-filename function is labeled such that it should only be called after the 
dialog has completed, and there appears to be no way to change the filename 
once the panel has started (ie to show the correct extension).

How is NSSavePanel supposed to work?   I could try groping around in the panel 
to locate the NSTextView or NSTextField for the file name, but that is crass 
and prone to problems later if not sooner. 

Do I HAVE to implement the delegate methods (isValidFilename?) to check the 
file extension for it if I supply an accessory view? In a spot where there is 
only a single valid file type, my code doesn't do the setAccessoryView and then 
the extension is showing up OK. It's using the same file extension array in 
both cases. The only change as far as the panel is concerned is whether or not 
an accessory view is set --- the behavior changes even if I don't change the 
popup button.  There are no  calls sent to the NSSavePanel -- the behavior has 
changed just based on the presence of the accessory view. (A bunch of calls get 
made to the popup button, but that doesn't do anything to the save panel---it 
only does the setRequiredFileType when the user changes the popup.)

If all else fails, I guess I'll have to prevent the panel from showing the Show 
Extensions box (never an extension visible), and tack on the correct extension 
manually upon completion. But that will mess up the existing-file checks I'd 
guess, so I'll have to waste some more time to replicate that too. It does not 
check a user-supplied extension against the specified one either. And the cocoa 
version will have to be less functional than the carbon version. 

10.5/64bit


      
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to