Page 1 of 1

'answer file of type' not working on Leopard

Posted: Sat Jan 12, 2008 4:45 pm
by Martin Koob
I am developing an application using Mac OS X 10.4 and am now testing the standalone on Leopard. My application has its own document type and the following code doesn't work in the standalone running under 10.5. (It works fine in Tiger)

Code: Select all

answer file "Select a file." with (the pdefault folder of stack "preferences")  of type "XvLw" as sheet
The sheet does display and I can navigate to the folder containing my document but the document is greyed out and can't be selected. If I double click on the document from the finder it does open in the application correctly.

Posted: Sat Jan 12, 2008 4:55 pm
by BvG
The "answer file with filter|of type" form is deprecated, so i can't give you tips on that. I always use the "answer file with type" form, in your case like this:

Code: Select all

answer file "Select a file." with (the pdefault folder of stack "preferences")  with type "Description|xml|XvLw" as sheet 
where xml is a suffix (as in "file.xml"), and XvLw is a mac os file type. Note that mac os file types only work if the file actually has a resource fork (see the resfile keyword in the docu on how to set it).

Posted: Sat Jan 12, 2008 5:14 pm
by Martin Koob
Thanks for the quick reply.

One further question about the type values. The first value you put is 'Description'. What is this used for and what should you put here.

I did not see the word 'Description' anywhere in the file dialog.

Is this text that I use to describe the type of file or is it a predetermined value for each type of file?

Posted: Sat Jan 12, 2008 6:24 pm
by Mark
Martin,

Try

Code: Select all

answer file "Select a file." with (the defaultFolder) with type "Description|xml|XvLw" or type "All files|*|*" as sheet 
(Note that I'm using the defaultFolder for testing).

Best,

Mark

Posted: Sat Jan 12, 2008 9:32 pm
by Martin Koob
Oh I see how that works.

If there is just the one type in the command it will not show anything in the file dialog.
if I have the two types then there is a pull down menu called 'Enable:' with the two options, in this case 'Description' and 'All files'

Thanks to both of you for your help on this.

Martin