LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to omit the popup warning "Do you want to replace the existing file"?

Solved!
Go to solution

Well, the title says it already Smiley Wink

 

I have an application where the user may save results to a log file; these data are appended

(using OpenFile ( file_name, VAL_WRITE_ONLY, VAL_APPEND, VAL_ASCII );), so opening this file will not replace its contents but add to it. It may be thus meaningful to reuse the same file.

 

Unfortunately, when calling FileSelectPopupEx () and selecting an existing file the warning appears that the file already exists. This is OK. But the message continues saying "Do you want to replace it?" In this particular case this message is quite confusing for the user because the program will not replace anything (which of course is unknown to the FileSelectPopupEx () function).

 

So I am wondering if there is a possibility to avoid or change this message popup?

 

Thanks!

0 Kudos
Message 1 of 3
(3,418 Views)
Solution
Accepted by topic author Wolfgang

Which constant have you passed to buttonLabel parameter? The behaviour of the function changes depending on the button shown. In particular (quoting from the help):

 

Note   If VAL_SELECT_BUTTON or VAL_LOAD_BUTTON is passed to the buttonLabelparameter, the FileSelectPopupEx function confirms the selected file exists. If the file does not exist, the function prompts the user to select an existing file.

 

Using the Save button should lead to the confirmation message you are facing now.

I suppose if you use the simple OK button you will receive no prompt (to be confirmed: I'm not sure but I cannot test it at the moment).



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 3
(3,411 Views)

Thanks, Roberto, you are right, I forgot about the different meanings of VAL_SAVE_BUTTON (confirm overwrite) and VAL_OK_BUTTON (no confirm).

 

If NI feels like improving their documentation they could add the difference between these two buttons to the documentation, too Smiley Wink

0 Kudos
Message 3 of 3
(3,403 Views)