Skip to content
⌘ NSIS Forum Archive

visible Components depending on InstType

11 posts

LazyBear#

visible Components depending on InstType

Yeah...it's going on... I'm learning 😁

well - I've another boring question 😉 :

I Have 3 Install types with very different Sections
so I want to show only the Sections of the chosen InstType
like this:

Type 1
full Software
(Server database used)

Type 2
Software(Serverbased)
(Server database used)

Type 3
full Software
own Database

It should appear like this^^
but I don't know how to 🙁

maybe I'm still to silly to find it in the Manual...

😢

so long -L-B-
kichik#
You can't hide components when the components page is already shown. If you want to not let the user select some sections, you can make them read-only (SectionIn RO).
LazyBear#
hmm

is there any other way to let the user choose an Installtype and then show only the components included?
kichik#
Well, you can create a custom page for either one. A custom page for selecting the install type or a custom page for showing the selected sections. You can also create one custom page for both using the new NOTIFY code in InstallOptions. Create 3 radio buttons, use the NOTIFY flag for all and change the text on some other control in the page according to the NOTIFY code. See Contrib\InstallOptions\testnotify.nsi for an example.
Vytautas#
You can create a custom InstallOptions page with either 3 radio buttons, one for each install or even a drop-down combobox which will allow the user to chose the install type. Then just display the custom page before the component page and then disable/hide the required sections.

Vytautas
LazyBear#
further question

Ok, I think I've got it... step by step but with a real success... thats great!

Well I need to know, how I can choose the Sections with the Script...

I've built an IO Page with 3 RadioButtons, and give their value to a variable, because I show an info depending on this "Install Type". It looks fine and works good, but there is no real important function because I need to choose the Sections with this RadioButtons...

k thats it...bad english, I hope you anderstand

so long -L-B-
Comm@nder21#
ok, i'll explain in german, it's easier for me and you:

definier als erstes ne leave-function für deine custom-page oder ne pre-function für deine componentspage.
Page custom prefunction leavefunction
Function leavefunction
FunctionEnd
oder:
!define MUI_PAGE_CUSTOMFUNCTION_PRE prefunction
!insertmacro MUI_PAGE_COMPONENTS
in der liest du dann die installoptions.ini deiner custompage aus und setzt die entsprechenden section-flags. wenn eine section unsichtbar sein soll, ändere ihren namen mit sectionsettext auf "".
LazyBear#
another Idea

Well I have an Idea... I don't know if NSIS is able to handle it...

What about writing the stuff I want to Install into a ini or txt file - just like:

SetOutPath $INSTDIR\Folder1


File "C:\File 1.dat"
File "C:\File 2.mpg"
File "C:\File 3.exe"

then I write a second file like

File "C:\File 4.dat"
File "C:\File 5.dat"
File "C:\File 6.exe"

depending on the selection I use one of this txt/ini files
as a section or in the section

maybe this Idea is useless... this would be exactly what I need... maybe someone can help me
kichik#
Hmm... I am not sure I understand. If it's depending on the section, why not just put it in the section? The section code will not be executed if the section is not selected.
Section 1
File "C:\File 1.dat"
File "C:\File 2.mpg"
File "C:\File 3.exe"
SectionEnd

Section 2
File "C:\File 4.dat"
File "C:\File 5.dat"
File "C:\File 6.exe"
SectionEnd
LazyBear#
you're right

yes thats the normal way... but I didn't really understand how to set the section flags... I've read the examples, but anyway I didn't understand... well I haven't the time to learn it consequent... not in the moment... sad but true