LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Hide, disable, or change behavior of Ok button in File Dialog express vi?

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.

0 Kudos
Message 1 of 10
(3,659 Views)

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"…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 10
(3,647 Views)

In the Express VI, change it to folder selection.  And then you can rename the button thru one of the Express VI inputs.

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 3 of 10
(3,640 Views)

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.

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 4 of 10
(3,621 Views)

@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

0 Kudos
Message 5 of 10
(3,614 Views)

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.

0 Kudos
Message 6 of 10
(3,592 Views)

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. 

Example_VI_BD.png

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
Message 7 of 10
(3,582 Views)

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.

"If you weren't supposed to push it, it wouldn't be a button."
Download All
0 Kudos
Message 8 of 10
(3,572 Views)

Check this link.  Includes a Windows API codepack that you can use to embed an explorer window. 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
Message 9 of 10
(3,561 Views)

@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.

0 Kudos
Message 10 of 10
(3,540 Views)