Old 5th October 2007, 03:49   #1
Jobol
Junior Member
 
Join Date: Oct 2007
Posts: 2
Question 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.
Jobol is offline   Reply With Quote
Old 5th October 2007, 06:06   #2
demiller9
Senior Member
 
Join Date: Mar 2006
Location: Dallas
Posts: 462
Try using SectionSetText (with SectionGetText).

Don
demiller9 is offline   Reply With Quote
Old 5th October 2007, 09:02   #3
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
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

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 7th October 2007, 01:19   #4
Jobol
Junior Member
 
Join Date: Oct 2007
Posts: 2
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.
Jobol is offline   Reply With Quote
Old 7th October 2007, 18:21   #5
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
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.
code:
FindWindow $0 "#32770" "" $HWNDPARENT
SendMessage $0 0x40f 0 0


NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump