pozbremser
19th December 2007 11:17 UTC
get file dialog
hello
I need a custom page with a button for filesystem.
user clickt button, select *.reg file.
and regedit run the file after that.
It's something like "MUI_PAGE_FILE"
but there is only MUI_PAGE_DIRECTORY
how can I do it?
only one option: FileRequest exist?
I use MUI
Thanks.
Red Wine
19th December 2007 15:38 UTC
Checkout the included examples.
InstallOptions is what you're lookinng for,
http://nsis.sourceforge.net/Docs/Ins...ns/Readme.html
Animaether
19th December 2007 15:38 UTC
You can create a custom page (Page custom fn_enter fn_leave) using InstallOptions or nsDialogs. InstallOptions might be easier for you to get up and running with as there are many examples. nsDialogs is still relatively new but appears to be more future-ready.
Within the custom page you can create a FileRequest field, which can pop up a file browsing dialog. Seems to be what you're looking for.
pozbremser
19th December 2007 17:24 UTC
super!
Thank You for answers!
I try it.
pozbremser
20th December 2007 14:59 UTC
I created custom page with Type=FileRequest.
But I want the page would be like MUI_PAGE_DIRECTORY.
At first is next-button deactivate.
only if selected file exist, user can go on.
how can I do it?
Thank You.
Animaether
20th December 2007 16:27 UTC
disable the button in the custom page enter function:
GetDlgItem $0 $HWNDPARENT 1 ; Next button
EnableWindow $0 0
Then in the custom page leave function, check if the file exists, and enable it if it does, disable if not:
; assume $1 to hold the filename
GetDlgItem $0 $HWNDPARENT 1 ; Next button
IfFileExists $1 _enable _disable
_enable:
EnableWindow $0 1
goto _done
_disable:
EnableWindow $0 0
goto _done
_done:
Make sure you set the flag FILE_MUST_EXIST in the filerequest control of your installoptions.ini file as well. This won't prevent a user from entering an invalid file in the textbox (which is why you still need to check it in the exit function), but it will warn the user that the file is invalid (doesn't exist) when they are using the file browse dialog.
pozbremser
21st December 2007 10:18 UTC
Thank You,
I can deactivate next button now.
Next button must be activated, if the license file exist.
If next button is deactivated, I cann't reach leave-funktion. It is something like fileopen-event of FileRequest,where I can check the file and activate next again.
Animaether
25th December 2007 03:01 UTC
You should be able to set a NOTIFY flag on the filerequest. That will cause the leave function to be called. You'll have to check the status of the installoptions file to see whether the user used the filerequest control or the next button or some other element in your dialog to deal with code handling. Make sure to call 'Abort' for any of the things that aren't the Next button, so that the installer will remain on the same page (i.e. your dialog)