LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Prevent deletion from file dialog

I want to allow the user to interactively select a folder for data logging, but he shouldn't be allowed to delete any existing data files. The path control doesn't have any options to prevent this as I see it.

As a possible alternative, I recall seeing a very simple directory-only selection dialog from the Windows API (I think). However, before hunting around for this, I would prefer to find a LabVIEW-native solution.

Thanks,
-David Moerman
0 Kudos
Message 1 of 6
(3,224 Views)
Use the "File dialog" from the advanced File IO palette.

-- Select "Existing dir" for the mode
-- Wire a single space character to the pattern (for example).
-- I assume the file name will be programmatically generated.

--> The file dialog will only show folders, because the file pattern never matches. (Of course, this is only a soft barrier, because users can still select "all files", highlite a file, then hit delete.)
0 Kudos
Message 2 of 6
(3,223 Views)
Thanks, we're close but not quite there.

Even without selecting 'all files', the user can still see and delete entire folders!

-Dave
0 Kudos
Message 3 of 6
(3,223 Views)
Hi, David,

The easiest way for solution - using "LabVIEW" open file/directory dialog instead of native Windows dialog.
Just select Tools->Options->Miscellaneous and uncheck "Use native file dialog" option.
This is native LabVIEW solution (but "LabVIEW-style" dialogs looks a little bit non-standard).
0 Kudos
Message 4 of 6
(3,223 Views)
Perfect! It works well, my users don't care if the dialog is non-standard, and it certainly prevents the unwanted behaviour. The only thing I have to remember is to include "useNativeFileDialog=False" in the ini file of my built application.

Thanks!

-Dave
0 Kudos
Message 5 of 6
(3,223 Views)
If it's that critical, then test for the INI file yourself, and create it if it's not there.
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 6 of 6
(3,223 Views)