Archive: adding a field into MUI_PAGE_DIRECTORY


adding a field into MUI_PAGE_DIRECTORY
Is there an easy way to add a field to the install folder page? I'm just starting to use MUI and didn't see anything obvious. What I would like to do is to display a text field or a number field below the folder selection page. Any help is appreciated!


InstallOptions can be easier...


I can define the field using InstallOptions, but how do I duplicate the folder selection and the browser button functionalities?


For the folder dialog, use DirRequest

See InstallOptions docs.


Originally posted by Lobo Lunar
For the folder dialog, use DirRequest

See InstallOptions docs.
OK, I looked at InstallOptions example test.nsi, and used the part for DirRequest. Now I have 2 questions:

1. State=C:\Program Files\default_install_dir, can I use some variable like $INSTDIR so it's not dependent of the C drive?

2. How do I show 'Browse' inside the browse button? Now it's showing only "..."

Thanks for the help

1. State=C:\Program Files\default_install_dir, can I use some variable like $INSTDIR so it's not dependent of the C drive?
You have to write the folder name to the INI file with WriteINIStr everytime you need to show the page.

2. How do I show 'Browse' inside the browse button? Now it's showing only "..."
It's not possible only with InstallOptions. You would need to use SendMessage and use System plugin to call SetWindowLong to set text and adjust the browse button.


1. There is a plugin called InstallOptionsEx (see my signature) which enables you to just write a common variable ($0-$9, $R0-$R9) to the INI file. The plugin automatically gets its contents when you reserve or show a page. (I plan to put the support for $INSTDIR in the future)

2. InstallOptionsEx also have the DirRequest control separated into Text + Button w/ DIRREQUEST flag so you can customize every aspect of the two controls, even use different notifications for each one.

Thanks very much, major dude. I'll play around with your InstallOptionsEx.


Ok, for the browse button, how do I make the folder selection to show?

my test.ini looks like this:

[Settings]

[Field 1]
Type=label
Text=Select Destination Folder
Left=0
Right=-20
Top=0
Bottom=16

[Field 2]
Type=Text
Left=0
Right=-40
Top=20
Bottom=32
Width=180
MaxLen=260
State=C:\Program Files\Netscape\Netscape10


[Field 3]
Type=Button
Text=Browse
Left=200
Right=-1
Top=20
Bottom=32
Flags=DIRREQUEST
State=???
ListItems=Text above the tree view

What should I use for State? And do I need to code to put what the user selects from the Browse button into the Text field (Field 2)?


What should I use for State?
Just put the number 2.

And do I need to code to put what the user selects from the Browse button into the Text field (Field 2)?
Absolutely not. This is done by the plugin itself. The only thing it depends on is the Field number where it outputs text.

And you also have to put the notification ONCLICK on the Notify INI value name or it won't execute. Like for example:

Notify=ONCLICK

Remove the Width or Right INI value name from Field 2. Width has an higher priority in the latest version, so it will be used, even if Right is set. (I should fix this on the next version)

Umm, the straight question related to the test.ini above is, why doesn't the browse button show the folder selection window when I click it? I can see that the default install folder is displayed in the text box, I can even use WriteINIStr to set it to $INSTDIR, but the browse button does nothing (this is on Win2K).


Sorry, deguix, I saw your last post just when I submitted my post. You can ignore my last question.


One more question, please. I was able to put the folder selection controls on the same page as an (optional) zip code field. However, the back button doesn't show up, the buttons i see are Install and Cancel, whereas I expect to see Back, Next, Cancel. As soon as a folder is selected by clicking the Browse button, it goes to install.
I also noticed my INI file is updated with State=0 right below "Settings". Is that a clue? I have none right now :)

Here's a snippet of the code for my pages:

Page custom WelcomePage

!insertmacro MUI_PAGE_LICENSE "license.txt"

Page custom SetCustom ValidateCustom ": Select Folder and US zip code"
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_UNPAGE_INSTFILES


the back button doesn't show up
You can enable that on the Settings INI section with BackEnabled=1.

I also noticed my INI file is updated with State=0 right below "Settings".
There should appear also a Notify INI value on Settings INI section. That's because you used a notification (ONCLICK).

Thanks for warning me of those. One person doing everything is really difficult and bugs generally escape from my hands. I'll be going to fix both of them on the next version.

You can enable that on the Settings INI section with BackEnabled=1.
Whooops! It's BackShow=1 to show the back button. BackEnabled=1 only enables the button if it's already visible.

There should appear also a Notify INI value on Settings INI section. That's because you used a notification (ONCLICK).
In this case it wasn't appearing... Another thing to take care of.