Skip to content
⌘ NSIS Forum Archive

Custom Page with FileSelect-Button

12 posts

klopfdreh#

Custom Page with FileSelect-Button

Hello,

I want to create a Custom Page with InstallOptions. On this page there should be a button and when the user clicks on it he can select some files, that are copied in a folder located in the installationfolder. What I finished is to create the InstallOption and to show the Custom Page via Macros in my Installer.

The problem still left is to popup the filerequest dialog when the user clicks on the button. Im using a Dialog-Plugin that is working already:

Dialogs::Open "Jar Files (*.jar)|*.jar|" "4" "Choose a file from the list" $EXEDIR ${VAR_6} 
I'm new to NSIS and I don't know how to handle the click event, so is anyone able to help filling the two functions
Function TestStart
...
FunctionEND
Function TestLeave
..
FunctionEND 
The last thing I think I should post is the InstallOption ini File:
[Settings]
NumFields=1
[Field 1]
Type=Button
Left=244
Top=121
Right=294
Bottom=136
Text=Button
Flags=
State=DirBrowseButton 
Thanks a lot!
klopfdreh#
Ok, thanks a lot! I will look the manual of nsDialogs and if there are any Questions I'll post it here!

Nice Support here!
klopfdreh#
How can I place the button in the center space in the Custom Page? I used this for now:

    nsDialogs::CreateItem /NOUNLOAD BUTTON Test ${BS_LEFT}|${BS_TOP} 150 100
    Pop $BUTTON
    GetFunctionAddress $0 OnClick
    nsDialogs::OnClick /NOUNLOAD $BUTTON $0 
Function OnClick
MessageBox MB_OK clicky
FunctionEnd 
But there is only an error when I click on cancel.

Thanks!
klopfdreh#
Can you give me the URL to the correct download - I thinks I got an older ZIP File there is no nsDialogs.nsh or a manual.
Afrow UK#
nsDialogs is included with NSIS. Just make sure you have the latest version of NSIS.

Stu
fabian.rap.more#
nsDialogs.nsh will be in the include folder where you installed NSIS

[edit]Oops..........i should refresh the page more often before posting [/edit]
klopfdreh#
I'm using 2.34 2.35 is the newest. I read the changelog. There is no entry about nsDialogs, so I think I can use it as well as in the newest.

Edit: Ok got the manuel and my first page running with nsDialogs! I'll make some tests furtheron
klopfdreh#
Great - Got a button now and when I'm pressing on that button a filerequest-dialog is opening! 🙂

So still some questions left:
  • How can I change the description in the modern ui?
  • How can I setup a multiple selection and run throw the result with a loop to copy those files in the installationdirectory?


Thanks for the great help
Afrow UK#
Dialogs plug-in probably doesn't allow multi-select but DialogsEx may do. nsDialogs also has a file selection macro I believe if you haven't tried it.

Do you mean MUI_HEADER_TEXT for the description?

Stu
klopfdreh#
Great, MUI_HEADER_TEXT was exactly what I was looking for and furtheron I will get the Multiselection Dialog running for me with DialogsEx!

Thanks so far!

Edit: There is no documentation about how to get DialogsEx can select multiple files, anyone here know how to do? 🧟