• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Getting file type from Save dlog
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting file type from Save dlog


  • Subject: Re: Getting file type from Save dlog
  • From: Kevin Perry <email@hidden>
  • Date: Wed, 30 Jan 2013 13:15:32 -0800

On Jan 30, 2013, at 12:32 PM, Steve Mills <email@hidden> wrote:

> On Jan 25, 2013, at 16:42:01, Kevin Perry <email@hidden> wrote:
>
>> If you’re using your own accessory view instead of the built-in one (shouldRunSavePanelWithAccessoryView), you’re responsible for changing the value of fileTypeFromLastRunSavePanel. One way to do this is to make your NSDocument instance the target of the popup button’s action and change an internal ivar inside that action method.
>
> I finally got this all figured out. This is a mess. It's goofy that Apple decided to send the localized type name strings here

I’m not following you here. What is sending localized type names where?

> instead of the actual types supplied, which would be extensions or UTIs. Those would make *so* much more sense.
>
> I ended up overriding writableTypesForSaveOperation. It took me a long time to figure out why it was *always* showing 3 types when I was passing it 2. Then I figured out that those 3 types are in the Info.plist with a NSDocumentClass that's the same as the class that's showing the Save dlog, and a CFBundleTypeRole of Editor. NSDocument is trying to be too smart here and use those types, even though I specifically told the NSSavePanel to setAllowedFileTypes to just my 2 types. Boo to this mess for wasting my time.

The way NSSavePanel is designed, it is completely agnostic of the accessory view inserted into it, even one owned by NSDocument. It has no idea how to change the contents of the accessory view based on what you pass to -setAllowedFileTypes:—there may not even be a document type popup there at all.

If you want to customize what types NSDocument shows in its default accessory view, then overriding -writableTypesForSaveOperation: is exactly the right thing to do. Sorry for the trouble you had in discovering that—would you like to file a documentation bug with a suggested improvement?

-KP

> --
> Steve Mills
> office: 952-818-3871
> home: 952-401-6255
> cell: 612-803-6157
>
>
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> 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:
>
> This email sent to email@hidden


_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Getting file type from Save dlog
      • From: Steve Mills <email@hidden>
References: 
 >Getting file type from Save dlog (From: Steve Mills <email@hidden>)
 >Re: Getting file type from Save dlog (From: Kevin Perry <email@hidden>)
 >Re: Getting file type from Save dlog (From: Steve Mills <email@hidden>)

  • Prev by Date: Re: Getting file type from Save dlog
  • Next by Date: Re: Getting file type from Save dlog
  • Previous by thread: Re: Getting file type from Save dlog
  • Next by thread: Re: Getting file type from Save dlog
  • Index(es):
    • Date
    • Thread