From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

file dialog with multiple custom patterns

Solved!
Go to solution

I am in need of being able to user select multple file patterns (*.bin, *.exe...) in a file dialosg similar to the express File Dialog VI where it lists the directory and allows the user to select multiple files from a windows dir listing.  The express VI has a patterns input that takes  multiple patterns separated by a semimcolon but there appears to not be a way of providing a ring control for file type and letting the user select the pattern that he wants to filter the directory listing with.  I.E> > If the user wants to only load files that are *.bin, he only wants to view them in the listing.  How can I do this without mutliple dialog boxes?

0 Kudos
Message 1 of 12
(5,104 Views)

Can you post your code?  That might help some.  Also, you could try a Combo Box to output strings, use a Case Structure for filtering selections, etc.  There's a lot of ways to do it. 

--------------------------------------------------

Nathan - Certified LabVIEW Developer
0 Kudos
Message 2 of 12
(5,101 Views)

I am merely looking to see if there is a way to use an off the shelf type of control that I dont know about.  Right now I am just looking at using the file dialog express VI. 

0 Kudos
Message 3 of 12
(5,099 Views)

Off-the-shelf might be something like a list box that allows multiple selections.  Or you could drop a cluster of booleans on the FP and parse the selected file types and place ;'s between them.  You could have multiple string controls that the user inputs the file extension and then you programmatically insert a ; I can't think of something off-the-shelf that easily does what you are looking for, these suggestions require a little bit of programming but should get you off to a good start at least.

 

This is the approach for choosing any desired types from a list.  If you want to choose only one, use a ring or combo box or enum...  Much simpler when only choosing one of many.

--------------------------------------------------

Nathan - Certified LabVIEW Developer
0 Kudos
Message 4 of 12
(5,089 Views)

You mean something like this:

 

Wire the discription of the first type of file into the "Pattern Display" input (I.E., "Word Files")

Then right click the format string and enable "codes display"

Then try something like this

"*.doc;*.docx)\00*.doc;*.docx;\00Bitmaps\s(*.bmp)\00*.bmp\00\00"

0 Kudos
Message 5 of 12
(5,074 Views)

Don,  thanks I tried what you said but i got a labview crash error.  Maybe I was doing something wrong here.  Can you make sure that I am doing what you said to?

0 Kudos
Message 6 of 12
(5,069 Views)

Your format string is incorrect.  Change the ?00 to \00.

Smiley Wink

0 Kudos
Message 7 of 12
(5,066 Views)

U da man -Thanks.  Thats exactly what I wanted...Smiley Very Happy

0 Kudos
Message 8 of 12
(5,062 Views)

Any leads as to where this string syntax is documented would be beneficial to my cause.

0 Kudos
Message 9 of 12
(5,050 Views)

The first time I saw it (from NIs side) was from one of Darren's Weekly Nuggets:

http://forums.ni.com/ni/board/message?board.id=170&message.id=497502&query.id=3663527#M497502

 

That dialog, I believe, is hooked from the Windows API so the best place it is documented are external sites dedicated to Windows API programming.

Example:

http://www.winprog.org/tutorial/app_two.html

 

ofn.lpstrFilter = "Text Files (*.txt)\0*.txt\0All Files (*.*)\0*.*\0";

This is roughly the same type of format string.  We just need to enable special codes display to place in the nulls.

Message 10 of 12
(5,047 Views)