Jump to content

Specifying multiple file types (by extension) for File Dialog fails


Recommended Posts

[cross posted to ni.com]

The file dialog allows specifying multiple types (that can be selected by the user) by passing the dialog primitive a semicolon delimited list of patterns. For example, you can allow the user to choose TXT or INI file types by passing a pattern of "*.txt;*.ini" to the file dialog primitive, as shown below:

post-17-1227994004.png?width=400

However, when this is run on Mac OS X, neither of the specified file types is selectable by the user, as shown below:

post-17-1227993928.png?width=400

I have tested this on LabVIEW 8.2 and 8.6 for Mac -- both have the same problem. Here is an example that can be used to test the bug:

Download File:post-17-1227995063.zip

The help documentation for the File Dialog primitive states that this should work on all platforms -- there is no exception for Mac:

QUOTE

pattern (all files)

Restricts the files displayed in the dialog box to those whose name matches pattern (all files). pattern (all files) does not restrict the directories displayed. The pattern matching in this function is similar to the matching used in matching wildcards in Windows and Linux file names. If you specify characters other than the question mark character (?) or the asterisk character (*), the function displays only files or directories that contain those characters. You can use the question mark character (?) to match any single character. You can use the asterisk character (*) to match any sequence of one or more characters.

For example, a pattern (all files) of *.vi;test*.llb returns matches for any file with a .vi extension and any file whose file name begins with test and has a .llb extension.

To match multiple patterns, use a semicolon ( ; ) to separate the patterns. White space, such as blanks, tabs, and carriage returns, are taken literally. Avoid using white spaces unless they are part of the extension pattern. For example, if you use *.html;*.doc, the dialog box displays all files that end with .html and .doc. If you use *.html; *.doc, the dialog box displays only files that end with .html.

Does anyone know a work-around or if I'm doing something wrong?

Link to comment

Sounds like a bug to me. For a work-around, I don't have a mac to test but...

We can assume that there is an OS primitive dialog that LabVIEW calls. So try to figure out what the dialog in question is. It may be tk_getSaveFile or something similar. Now check the manual page for the identified OS primitive, how you should pass it the file pattern list and try to mimic it in your LabVIEW file pattern input. I don't know if this helps at all but maybe gives you a little hope.

Link to comment

QUOTE (Tomi Maila @ Nov 29 2008, 03:24 PM)

Sounds like a bug to me. For a work-around, I don't have a mac to test but...

We can assume that there is an OS primitive dialog that LabVIEW calls. So try to figure out what the dialog in question is. It may be http://developer.apple.com/DOCUMENTATION/Darwin/Reference/ManPages/mann/tk_getSaveFile.ntcl.html' rel='nofollow' target="_blank">tk_getSaveFile or something similar. Now check the manual page for the identified OS primitive, how you should pass it the file pattern list and try to mimic it in your LabVIEW file pattern input. I don't know if this helps at all but maybe gives you a little hope.

Hi Tomi,

Thanks for the suggestion. I guess a work around might be to create our own native file dialog using Carbon Framework API calls.

-Jim

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.