Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 1st August 2012, 07:40   #1
within
Junior Member
 
Join Date: Aug 2008
Posts: 19
Question Install Type with specifi choicxe and hidden selection: How?

Hi everyone,

Purpose of my Installeur
I'm preparing an installer with the ability to install an application available in 2 versions.

Principles to follow
For each version, I have dedicated files, and dedicated settings (different network card settings for example).

I'd like to offer the user to have 2 choices only:
- Install type Development
- Install type Operation_only

For each choice, I wrote 2 dedicated sections, for which file path, settings and targets are different.

So, I have 4 sections:
- Section Development_File
- Section Development_Settings
- Section Operation_File
- Section Operation_Settings

So, for Install type Development, the user should only see the sections Development_File
& Development_Settings, the 2 others should be hidden. He can select or unselect 0, 1 or both of these 2 components. Based on the same idea, if he chooses Install type Operation_only, the 2 Development related sections will be hidden and he will be able to choose among the 2 Operation sections available only.

Problem
I spent quite some time now, reading the NSIS documentations, examples with install type, or using radio butrtons with slection/unselection macros, but I can't fin a way to properly do this. Either I see all 4 sections, or I have no selection options available... I tried also with SectionIn, but I can't figure out how it works...

So, if one of you have some remarks, comments and especially some help to provide me, I would be very happy!

Thanks in advance,
within
within is offline   Reply With Quote
Old 1st August 2012, 07:49   #2
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,840
There's no need to hide sections, you can simply make the Op sections and Dev sections mutually exclusive.

1. Make two sectiongroups. One containing Dev_File and Dev_Settinsg, and one containing Op_File and Op_Settings. http://nsis.sourceforge.net/Docs/Chapter4.html#4.6.1.5
2. In .onInit, enable the default sections and disable the others (use the macros in Sections.nsh). Also, set a variable to store this selection state (Op or Dev).
3. In .onSelChange:
code:
${If} $State == "Dev"
${If} ${SectionIsSelected} ${Op_File}
${OrIf} ${SectionIsSelected} ${Op_Settings}
!insertmacro UnselectSection ${Dev_File}
!insertmacro UnselectSection ${Dev_Settings}
StrCpy $State "Op"
${EndIf}
${Else}
${If} ${SectionIsSelected} ${Dev_File}
${OrIf} ${SectionIsSelected} ${Dev_Settings}
!insertmacro UnselectSection ${Op_File}
!insertmacro UnselectSection ${Op_Settings}
StrCpy $State "Dev"
${EndIf}
${EndIf}



That's all.
MSG is online now   Reply With Quote
Old 1st August 2012, 08:03   #3
within
Junior Member
 
Join Date: Aug 2008
Posts: 19
MSG, that looks promising.
I will look how to make section groups.
I am not sure there are real "default" sections, just Dev or Ope. If you mean, making one of these 2 as default, I guess it means it is the "on startup" selection of install type...

Thanks for your help!
Will come back when done.
within is offline   Reply With Quote
Old 1st August 2012, 09:57   #4
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,840
Quote:
Originally Posted by within View Post
If you mean, making one of these 2 as default, I guess it means it is the "on startup" selection of install type...
Yes, that's what I mean. If you want none to be selected by default, simply disable all sections and set the state variable to empty.
MSG is online now   Reply With Quote
Old 2nd August 2012, 00:39   #5
within
Junior Member
 
Join Date: Aug 2008
Posts: 19
I am back with some feedback as promised.

Method worked perfectly as you mentioned, MSG.

To summarize, I did add the 2 sebsections:
code:
SectionGroup "Dev"
Section "Dev_File" Dev_File
#code#
SectionEnd
Section "Dev_Settings" Dev_Settings
#code#
SectionEnd
SectionGroupEnd
SectionGroup "Op"
Section "Op_File" Op_File
#code#
SectionEnd
Section "Op_Settings" Op_Settings
#code#
SectionEnd
SectionGroupEnd



I defined a varibale to follow:
code:
Var /GLOBAL State



and in on.Init function I added the following lines at the end to have the Dev sections to be selected by default:
code:
StrCpy $State "FAS HMI for Development"
!insertmacro UnselectSection ${"Op_File}
!insertmacro UnselectSection ${Op_Settings}

within is offline   Reply With Quote
Reply
Go Back   Winamp 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