• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Using the IOpenFileDialog Interface

Explorer ,
Sep 06, 2011 Sep 06, 2011

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

TOPICS
SDK

Views

1.3K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Sep 06, 2011 Sep 06, 2011

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

...

Votes

Translate

Translate
Community Expert ,
Sep 06, 2011 Sep 06, 2011

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 06, 2011 Sep 06, 2011

Copy link to clipboard

Copied

Thanks Manan. I'll give it a try.

R,

John

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Sep 07, 2011 Sep 07, 2011

Copy link to clipboard

Copied

How about SDKFileDocumentChooser

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 07, 2011 Sep 07, 2011

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 07, 2011 Sep 07, 2011

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 07, 2011 Sep 07, 2011

Copy link to clipboard

Copied

Hi John,

If the suggestions solved your query, please mark the question as answered.

Manan Joshi

www.metadesignsolutions.com

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 07, 2011 Sep 07, 2011

Copy link to clipboard

Copied

Taken care of, as requested.

R,

John

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 07, 2011 Sep 07, 2011

Copy link to clipboard

Copied

LATEST

Thanks

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines