LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Restrict browse window to single directory

Hi !
I want to restrict browse window to single directory.
Please see the bmp image.
Here i m giving browse file option C:\US\
Now i want that - user can brows only those folder in C:\US\.
I want to restrict user to brows other folders from this browse button.

Please give me the solution.
Thanks in Advance

Kaustubh
VC (Pune)
INDIA
Message 1 of 4
(2,629 Views)
I don't know of a way to restrict the File Dialog, but perhaps there are some UI alternatives.

Use a Ring control instead of a Path control. Populate the ring with the output from primitive List Folder.

If you want a different UI (e.g. if you know the list might be large), use a path control to hold the value and create your own browse button to invoke a "restricted" file dialog; e.g. one which mimicks some of the File Dialog UI look and feel a bit better, but which does not allow you to change folders.

If you go with a free format entry control (e.g. a path control), you will need to include your own checking to ensure they didn't enter a path to a location you don't support.

Roy
Message 2 of 4
(2,598 Views)
In addition to Roy's idea, you could start the browse button in the allowable directory (which would encourage local selection), and then perform a check once the file has been selected. If the user does venture into a restricted folder, you could capture that path and prompt the user to pick from the proper folder. They would be able to select an improper file but the program would not progress until they selected an allowable file.

-Brett Burger
Message 3 of 4
(2,580 Views)
To add to Brett's suggestion,

You could store the value for the last directory inside a lookup file (text).
So when the user opens the folder, the folder selection is populated with the last one that was opened.

This way, it allows the flexibility to open other folders and remember which one was last opened. Unless you want to restrict to a single folder, then you could do the same without offering a choice of folders. In that case, you could store the static folder location in the file.

I use this method when developing code to make my life simpler. I have a boolean value that alters the behaviour of the vi (wired to a Case Statement) which allows selection why I run the vi and presents static settings for an operator. An example of static settings is the folder where the results reside. They can be indexed by login name.

I'm sure you get the picture.

Experiment and have fun.

JLV
Message 4 of 4
(2,564 Views)