LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Allow user to select only a folder with all files shown

Solved!
Go to solution

Hello,
By configuration, the 'Path File Control' in labview allows to select a folder but without showing the files inside (option folders).
In changing the configuration to option 'Files and Folder', we can see the files insides the folder but the button 'open' appears in additon to 'select folder' button.

In my application, only a folder must be selected by the user.
For the choice of the folder, I would like that the user can see files inside it.
So I try to realize a function with just a 'select folder' button and showing file inside it.
Please could someone help me to realize that ? Thanks a lot, Daniel.

0 Kudos
Message 1 of 7
(4,400 Views)

Hi Daniel,

 

So I try to realize a function with just a 'select folder' button and showing file inside it.

Build your own VI to select a folder.

- Use the ListFolder function to get the content of folders.

- Display the content in a listbox.

- Have the user select an entry in the listbox. Detect double-clicks to go into the next folder…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 7
(4,395 Views)

hi 

I tried with the folder/file/file or folder options and it shows the files(LV2011) .

bp
0 Kudos
Message 3 of 7
(4,380 Views)

Thanks for your suggestion.

Is it possible to realize the function using a WIndows file explorer like the File Path Control.

Maybe using the .NET pallette ?

BR, Daniel.

 

 

0 Kudos
Message 4 of 7
(4,347 Views)

I configure the dialog for "files or folders" (with optional pattern) and act as follows in the code:

 

  • If the user selects a file, I strip the file name and hand the path to the following code
  • If the user selects a path, it uses it directly.
  • If the user cancels the dialog, ignore the output and keep the previous path.

Very little code needed!

 

(example use)

0 Kudos
Message 5 of 7
(4,340 Views)

Thanks.

Can you explain how you check if the user select a file name or a path (folder)?

 

Your method is easy to implement but use 2 buttoms in the file explorer for the same objective....not very 'smart'.... I would prefer another method.

BR, Daniel.

0 Kudos
Message 6 of 7
(4,329 Views)
Solution
Accepted by topic author daniel_blanzat

@daniel_blanzat wrote:

Thanks.

Can you explain how you check if the user select a file name or a path (folder)?

 


Use this function. It has a boolean "directory" output that lets you decide how to proceed. trivial!

 


@daniel_blanzat wrote:

 

Your method is easy to implement but use 2 buttoms in the file explorer for the same objective....not very 'smart'.... I would prefer another method.


It is very "smart" because it allows the user multiple ways to effectively interact with the dialog (press "current folder", select a file, double-click a file, etc.). Many user are not very familiar with the "current folder" button and such.

 

Message 7 of 7
(4,324 Views)