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 Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
X.

Multiple Line Pattern in the Browse Options

Status: New

As requested by this fellow 8 years ago: http://forums.ni.com/t5/LabVIEW/Multiple-pattern-lines-in-path-s-Browse-Option/m-p/776968/highlight/..., it would simplify some GUI if the user could select from a drop-down list, which files to look for in a File Dialog pop-up window.

Currently, we get a single line:

Screen Shot 2016-04-11 at 18.33.05.png

This results in this kind of mess courtesy of the IMAQ Load Image Dialog.vi):

 

Screen Shot 2016-04-11 at 18.35.29.png

 

To update the snapshot illustrating this other thread, here is an example of MS Word in action, illustrating the desired behavior:

 

Screen Shot 2016-04-11 at 18.27.21.png

 

In other words, it helps cleaning up the results, while using a single dialog window for all kinds of different files (which will be dealt with differently down the line).

I am not sure how multiplatform that can be, but here is the file open dialog options from TextWrangler on MacOS:

 

Screen Shot 2016-04-11 at 18.30.21.png

 

so it seems that can be done.

The thread I am referring to had a link to a Windows API call, but the link is dead (probably the result of the recent disastrous site cleanup). And of course is not multiplatform.

5 Comments
X.
Trusted Enthusiast
Trusted Enthusiast

For reference (not sure whether this is what is used by LabVIEW):

 

MS Open File Dialog Filter

 

MacOS: Using the Open and Save Panels

 

I think a good syntax would be similar to that used by MS:

 

Pattern: *.ex1; *.ex2 | *.ex3 | *.ex4; *.ex5

Pattern Label: File Type 1 & 2 | File Type 3 | File Type 4 & 5

 

yielding something like this:

 

Screen Shot 2016-04-12 at 12.08.10.png

 

Note: I just realized that I have no idea what kind of object the pull-down file type list is. I can't find anything similar in the palettes...

X.
Trusted Enthusiast
Trusted Enthusiast

Nevermind, I found a solution (I wished it was documented in the help and I thus officially ask for a CAR on the Help of all functions/objects having browse options built-in).

Check this thread: http://forums.ni.com/t5/LabVIEW/file-dialog-with-multiple-custom-patterns/td-p/2297526

 

Basically, the solution is as follows:

 

Multiple Pattern Browse Option.png

 

giving the desired result:

 

Screen Shot 2016-04-12 at 13.24.28.png 

 

And to give back to Caesar what belongs to Caesar, check out this thread:

http://forums.ni.com/t5/LabVIEW/Darren-s-Weekly-Nugget-05-10-2010/m-p/1127402

X.
Trusted Enthusiast
Trusted Enthusiast

One question I realize this option raises is how to find out wich selection the user chose?

In principle, if each pattern appears only once, then there is no ambiguity (pattern => label = selection)

However, suppose a pattern appears in more than on line as illustrated here:

 

Poetry (*.txt)

Politics (*.txt,*.mp3)

Music (*.mp3)

 

retrieving the file path (and pattern) doesn't tell you how to handle the file (assuming politics needs to be handled differently from poetry), since the category it was selected in is not provided.

Is there a way to access this information, or is it simply not provided?

AristosQueue (NI)
NI Employee (retired)

X wrote:

> Is there a way to access this information, or is it simply not provided?

 

It is simply not provided to the best of my knowledge. The OS says you should know how to handle the file based on the file extension. The selection ring is just to filter the list for the users, not to provide any sort of change in how the file is handled. Even if there is a way to get it back, I would suggest it would be a very bad UI that would change the handling based on a selection ring that users do not see as relevant to the ultimate use of the file.

X.
Trusted Enthusiast
Trusted Enthusiast

I have given up on that option, but I am not sure it would be a bad GUI decision. Until I have an AI allowing me to distinguish between a poem and a political pamphlet or between a recorded town hall meeting and a symphonic concert (OK, all bad examples), it would help me to get a little bit of help with how to interpret a generic file format possibly containing a lot of different types of data.

That it is a historical limitation is one fact.

Right now I need post-loading user input.