Copy link to clipboard
Copied
Hello all.
I have a very simple question: I have this code on my Mac box (I removed some code for the sake of brevity):
InterfacePtr<IOpenFileDialog> FileWindow(static_cast<IOpenFileDialog*>(::CreateObject(kOpenFileDialogBoss, IOpenFileDialog::kDefaultIID)))
#ifdef MACINTOSH
// Add a few file types.
FileWindow -> AddType('IDd5');
FileWindow -> AddType('IDd6');
FileWindow -> AddType('IDd7');
FileWindow -> AddType('DATA');
FileWindow -> SetNavDlgOpFlags(kNavDontAddTranslateItems | kNavAllowStationery | kNavAllowPreviews | kNavDontAutoTranslate | kNavAllowMultipleFiles);
#else
...
This code works wonderfully for InDesign files CS3 and above, provided they have the right type (some files ported from a Windows box across a server may have a file type of 'DATA'), but if the file does not happen to have one of these types, (for example, a CS file happens to get mixed in with the newer files) it is greyed out and cannot be selected.
Is there a way to tell IOpenFileDialog to allow all files to be selectable?
This question applies to all Mac versions.
TIA!
R,
John
You can use the following method in IOpenFileDialog interface
void AddCustomMenu(const PMString& theName, SysOSType creator, SysOSType theType)
in this method send "kAllFileTypes" for both creator, theType
For the code snippet you have pasted, you could use
FileWindow->AddCustomMenu(filterName, kAllFileTypes, kAllFileTypes);
Where filtername is a PMString which represents the string which is displayed on the selection dialog for this filter. This code works for me on Snow Leopard.
Hope this solves you
...Copy link to clipboard
Copied
You can use the following method in IOpenFileDialog interface
void AddCustomMenu(const PMString& theName, SysOSType creator, SysOSType theType)
in this method send "kAllFileTypes" for both creator, theType
For the code snippet you have pasted, you could use
FileWindow->AddCustomMenu(filterName, kAllFileTypes, kAllFileTypes);
Where filtername is a PMString which represents the string which is displayed on the selection dialog for this filter. This code works for me on Snow Leopard.
Hope this solves your query.
Manan Joshi
www.metadesignsolutions.com
Copy link to clipboard
Copied
Thanks Manan. I'll give it a try.
R,
John
Copy link to clipboard
Copied
How about SDKFileDocumentChooser
Copy link to clipboard
Copied
The SDKFileDocumentChooser ShowDialog() method would also work.
But i gave the code in accordance to the code posted by John, so that minimum changes need to be done in the existing code.
Manan Joshi
www.metadesignsolutions.com
Copy link to clipboard
Copied
Thank you Manan and Pickory for your suggestions. Manan, I greatly appreciated your assistance. Pickory, I did not use SDKFileOpenChooser for two very good reasons:
1.) FileOpenChooser did not allow for the amount of flexibility I felt I needed at this point in the plugin when I first wrote that module, and,
2.) At the time I first wrote this part of the plugin I did not know of its existence (big toothy grin).
R,
John
Copy link to clipboard
Copied
Hi John,
If the suggestions solved your query, please mark the question as answered.
Manan Joshi
www.metadesignsolutions.com
Copy link to clipboard
Copied
Taken care of, as requested.
R,
John
Copy link to clipboard
Copied
Thanks