Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Filtering objects in Navigation open dialogs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Filtering objects in Navigation open dialogs



At 4:17 PM -0700 4/29/2002, Heather Donahue wrote:
In MacOS 9 it's possible to filter opening documents by creator and type. If I want my app to open a text document I can just filter by filetype 'TEXT'

Since it isn't necessary to have a type or creator in a MacOS X document, how do you filter the Navigation browser?

I'm guessing the only thing to filter by is the extension, '.txt' or '.text', but how do you do that from the Navigation browser?

Set a filterProc for your NavServices dialog. That's a NavObjectFilterUPP, which will be called for each item as it gets displayed in the dialog. From there you can get an FSRef and return whether your dialog will accept that item.


In the case of a text file, you'd check the type of the FSRef, and if it's TEXT, you'd accept it. If the type isn't TEXT, you'd check the extension, and if that's '.txt' or '.text' (or perhaps .c, .h, etc.), you'd accept it. You have to check both types and extensions, since any given file may have one, the other, or both of those set (or neither!).

If I recall correctly, the NavServices 2.0 documentation includes an example of a filter procedure.

Hope this helps,
Eric

--
Eric Albert                     email@hidden
http://www.stanford.edu/~ejalbert/
_______________________________________________
studentdev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/studentdev
Do not post admin requests to the list. They will be ignored.

References: 
 >Filtering objects in Navigation open dialogs (From: Heather Donahue <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.