![]() |
Remove Filerequest prompt to create new file
Hi All,
In my installer, one of my custom dialogs prompts the user to browse for a file with .lic extension. I am using nsDialogs with CoolSoft NSIS Designer. After clicking on the browse button, my file browse window only displays files with .lic extension. If the user types in any random say "test.lic" in the Filename area, the file browse window prompts for "test.lic does not exist. Do you want to create it?". How can I disable this ? Use should be able to only browse for files that exist. Appreciate any responses. --Pavan |
nsDialogs always passes the flag that makes this happen, you have to call GetOpenFileName with the system plugin to have control over the dialog: http://forums.winamp.com/showthread.php?t=171553
|
Thanks for your reply Anders. This is what I have in my code for the file request:
${NSD_CreateButton} 247.49u 100.31u 19.75u 12.31u "..." Pop $hCtl_FoundationDialog_FileRequest1_Btn ${NSD_OnClick} $hCtl_FoundationDialog_FileRequest1_Btn onClickfn Function onClickfn Pop $R0 ${If} $R0 == $hCtl_FoundationDialog_FileRequest1_Btn ${NSD_GetText} $hCtl_FoundationDialog_FileRequest1_Txt $R0 nsDialogs::SelectFileDialog open "$R0" "Lic File|*.lic" Pop $R0 ${If} "$R0" != "" ${NSD_SetText} $hCtl_FoundationDialog_FileRequest1_Txt "$R0" ${EndIf} ${EndIf} FunctionEnd So should I put a call for the GetOpenFileName with system plugin in the function onClickfn? I saw the thread you mentioned in your post. I compiled the example given by eccles. That installer launches a file browse window but still allows me to type in a file that doesn't exist. System::Call "comdlg32::GetOpenFileNameA(ir0) i.r9" what does the above do? --Pavan |
You would have to look at some of the flags for the OPENFILENAME struct on MSDN, there should be one that requires the file to exist. I can write a example for you tomorrow...
|
Thanks Anders!!
On MSDN it says that this is the property that is used: OFN_CREATEPROMPT So I need to disable this flag I guess? Thank you for looking into this and will wait for the response tomorrow. --Pavan |
Quote:
|
PHP Code:
|
Really appreciate it Anders!!!A big thank you
|
I'd like to point out that removing this prompt is not much of a roadblock. The user can just right-click in the open dialog and create a new file.
If you don't want the user to choose a empty file you should verify the file content and/or size in the page leave callback function. |
Hi Anders,
That is true. I never realized that. I will probably convince the people involved in this project to get this requirement put off, as it is not really a critical issue. We don't validate any content from that file as of now, when we get that requirement it would probably make sense to do a validation on the file content itself. Thanks again! --Pavan |
| All times are GMT. The time now is 18:02. |
Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.