Archive: Dynamic Section Name...Possible?


Dynamic Section Name...Possible?
Hi folks,

2 questions.

1. Is it possible to change the section name dynamically? NSIS seems only to accept const and not vars.

I tried:

Var sectionName "mySectionName"
...
# Installer sections
Section $sectionName SEC0000
...
SectionEnd

and the whole section dissapears!


2. Is it possible to add a custom button to the components page? (MUI)


What I want to do is basically have a custom button on the components selection page then when you click on, it searches for files on the filesystem, and then based on the results of that search, updates the title of the section to "[previous section name] (found)".

Thanks for any help you can give me.


Try using SectionSetText (with SectionGetText).

Don


Setting the section's name to a variable will work as long as you remember to set $sectionName before the components page is displayed. Passing another parameter to Var will not set the default value of $sectionName. It is in fact a bug that makensis.exe even accepts that syntax. I've fixed this for the next version.

To add a button, you can use one of the following plug-ins.

http://nsis.sourceforge.net/HelpButton_plug-in
http://nsis.sourceforge.net/ButtonEvent_plug-in


OK, so that's the catch. Is it possible to rename it after the components dialog is shown?

Like one would hot the search button, and that function updates the section's name.

Thanks.


Yes, you can rename a section while the components page is showing. Simply use SectionSetText in .onSelChange. You can also set the text and then send WM_IN_UPDATEMSG (0x40f) to the components dialog. But don't do that inside of .onSelChange.

FindWindow $0 "#32770" "" $HWNDPARENT
SendMessage $0 0x40f 0 0