04-04-2017 08:11 AM
I would like to open a file dialog box, so that the end user can simply use it to copy files for backup purposes. I tried the File Dialog express vi which works great except for one quirk, at least for my use case. Since I do not need the File Dialog to actually return a file, I don't care about any selection. The Cancel button will exit without a selection, after which I simply clear the resulting Error43. Unfortunately the OK button does not exit unless a file or folder is selected. I am concerned this will confuse the end user. Although I can change the text on the OK button, I can't seem to find a way to hide, disable, or change behavior of the OK button.
04-04-2017 08:19 AM - edited 04-04-2017 08:21 AM
Hi Edu,
one option you might follow is to open the FileDialog ExpressVI and check what's inside. Unfortunately you will end at "File Dialog" (no ExpressVI), which basically calls the OS file dialog: this is a dead end where you can't change any behaviour inside…
So an other option is to create your own file dalog VI with exactly the behaviour you want to present to your users!
Or you might search the forum, there are implementations that make use of dotNETs "Browse for Folder Dialog"…
04-04-2017 08:27 AM
In the Express VI, change it to folder selection. And then you can rename the button thru one of the Express VI inputs.
04-04-2017 08:53 AM
The default action of the OK button in folder selection mode is to select the current folder. It doesn't require the user to actually do anything at all since a folder is always open. There are a few exceptions to this. For instance, if the user clicks on My Computer in the shortcut bar, this is not a folder and the default button won't close the dialog. Another instance where this happens is the Libraries shortcut and the Network shortcut.
04-04-2017 09:04 AM
@aputman wrote:
In the Express VI, change it to folder selection. And then you can rename the button thru one of the Express VI inputs.
Thanks for the quick reply. If I select Folder the dialog does not show files at all, which means the user could not manually copy and past them to another folder. If I select File Or Folder, then I have 3 buttons to contend with - Current Folder, Open, and Cancel. Sure I can rename the Current Folder button to something like "Done", but I am still left with an Open button which is perhaps equally confusing
04-04-2017 09:45 AM
Can you run windows explorer in target folder, user will do copying there, then return to LabVIEW?
If you need to pause your program untill copying is done, show a dialog "press ok when done copying". Or switch mode automatically when user does something relevant on front panel.
I do not know what is the program logic, but if these files are part of the experiment, program should somehow work with them. Like "Backup recent experiment files", etc.
04-04-2017 10:09 AM
Ah right. I didn't think about the files not actually showing up. You could try playing with the Webbrowser .NET control. This might help to get you started. I'm sure there is already something available as a tool so you don't have to reinvent the wheel. There are a lot of edge cases that will arise when you try to make a file browser. One that I don't account for here is if you "DirectoryUP" past the root drive.
04-04-2017 10:45 AM
The File Dialog function has a 32-bit word for Selection Mode flags. Six of them (bits 26, 25, 24, 18, 17, 16) are for LLBs, New, Existing, Folders, Files, Multiple. 25 of them don't stick (always revert to 0). The other one (bit 27) sticks but doesn't seem to do anything. I tried lots of abnormal combinations and found nothing new. Attached is the code I used to poke around.
04-04-2017 11:15 AM
Check this link. Includes a Windows API codepack that you can use to embed an explorer window.
04-04-2017 01:36 PM
@aputman wrote:
Check this link. Includes a Windows API codepack that you can use to embed an explorer window.
This is awesome, thanks! I may end up playing with this but I'm rethinking how having the three buttons Current Folder, Open, and Cancel might not be as confusion as I initially thought. I've been using the LabVIEW Project Explorer's Move on Disk feature for some time, but only very recently noticed that those same three buttons are visible when THAT dialog comes up. In this use case, the user would never (ok, almost never) need the Open button since double-click on a folder does the same thing, yet there it is! So, if I relabel the Current Folder button to, let's say Done, then, I don't think it would be any more or less confusing than the Move on Disk dialog.