Archive: Newbie needs help with MordernUI


Newbie needs help with MordernUI
  Hi, i've read all the docs, read all the relevant post and looked at the examples but i'm still stuck :confused:
I'm using "Installer sections" as below

;Installer Sections
InstType "Full"
InstType "Singular"
Section "Full Theme" section_1
SectionIn 1
SetOutPath "$INSTDIR"
FILE "D:\LongHorn2\Home\LHv2Theme.CAB"
SectionEnd
Section "Home Screen" section_2
SectionIn 2
SetOutPath "$INSTDIR"
FILE "D:\LongHorn2\Home\LHv2Home.CAB"
SectionEnd
Section "System Theme" section_3
SectionIn 2
SetOutPath "$INSTDIR"
FILE "D:\LongHorn2\Home\LHv2System.CAB"
SectionEnd
Section "WMP Skin" section_4
SectionIn 2
SetOutPath "$INSTDIR"
FILE "D:\LongHorn2\Home\LHv2WMPSkin.CAB"
SectionEnd
Installer Sections
But i want to so that if InstType "full" is selected (section_1) none of the others are available and if any of SectionIn 2 are selected section_1 is not available (but any number of SectionIn 2 can be selected)

Also i do not want Custom to be in the drop down menu.

I've looked at the one-section.nsi example but cannot see how this applies to the ModernUI :hang:

Please help a Newbie in distress, i need to get this finished ASAP.

TIA
Richie M

Re: Newbie needs help with MordernUI
 

Also i do not want Custom to be in the drop down menu.
Use:

InstType /NOCUSTOM

This is propably not a Modern UI problem, but an NSIS instruction interpretation problem.

Quote from the documentation:

4.6.1.4 SectionIn
insttype_index [insttype_index] [RO]

This command specifies which install types (see InstType) the current section defaults to the enabled state in. Multiple SectionIn commands can be specified (they are combined). If you specify RO as a parameter, then the section will be read-only, meaning the user won't be able to change its state.
In other words, the installation types specified at SectionIn are just selected/deselected and not enabled/disabled. You have to change a section's enabled-state by using SectionSetFlags. You can find an example in the one-section.nsi file in your examples directory.

And to hide the 'Custom' option, use the InstType instruction:

InstType /NOCUSTOM 

>

Thanks, but how do i apply the code in one-section.nsi, that seems to be for the "basic" UI not ModernUI?


You can use the same code, there is no difference in script code between the Classic UI and the Modern UI.


Thanks, i'll give it a go :)


Ok, i'm getting there; i changed to second InstType to be


InstType /COMPONENTSONLYONCUSTOM 

>
(small note; there is a bug with this, if you hover the mouse over where the selection would be it still shows the description even tho they are hidden :( )
When I select Custom, "section_1" is still shown even tho its assigned to "SectionIn 1".
Is there no way to hide this if Custom is selected?

I have fixed the hidden bug, Joost will upload the source in a couple of seconds since my source has some other changes that are not fully tested yet in it.

What I suggest you do is set the custom string to whatever Singualr using:
InstType /CUSTOMSTRING=Singular

Then, according to the one-section.nsi example make it so when the user selects one of the 3 other sections unselect the first section (you can use macros from Sections.nsh too to make it simpler), and set it to Read-Only using the ${SF_RO} flag (defined in Sections.nsh [use !include Sections.nsh to include it]) and use the one-section.nsi code to make sure the user selects only one of the 3 other sections.

It's not possible to hide sections from .onSelChange. You can set a section's name (SectionSetText) to nothing ("") and then it won't show in any other place but .onSelChange.


Using a combination of InstType /COMPONENTSONLYONCUSTOM and InstType /NOCUSTOM will make the 'Component selection box' invisible for the whole installer. Since the user then can't select which sections he/she wants to install, you don't need to enable/disable the sections. You just use the SectionIn ionstruction.


Just read your post again:

But i want to so that if InstType "full" is selected (section_1) none of the others are available and if any of SectionIn 2 are selected section_1 is not available (but any number of SectionIn 2 can be selected)
You don't need one-section.nsi at all. Just set section1 to read-only (SectionIn RO) and change it's state according to the others. For example:

Function .onSelChange
SectionGetFlags ${sec2} $0
IntOp $0 $0 & ${SF_SELECTED}
StrCmp $0 ${SF_SELECTED} selected
SectionGetFlags ${sec3} $0
IntOp $0 $0 & ${SF_SELECTED}
StrCmp $0 ${SF_SELECTED} selected
SectionGetFlags ${sec4} $0
IntOp $0 $0 & ${SF_SELECTED}
StrCmp $0 ${SF_SELECTED} selected

# non of 2,3,4 are selected, select 1
SectionGetFlags ${sec1} $0
IntOp $0 $0 | ${SF_SELECTED}
SectionSetFlags ${sec1} $0
goto done

# one of 2,3,4 are selected
SectionGetFlags ${sec1} $0
IntOp $0 $0 & ${SECTION_OFF}
SectionSetFlags ${sec1} $0
done:
FunctionEnd

Thank you so much, i'll try that & let you know :)
(i did say one-section.nsi wasn't helping :P )


:D Thanks Kichik, got it working ;)
I stayed with; InstType /COMPONENTSONLYONCUSTOM as my second type.

Changed section_1 to be; Section "" section_1

And then used your code, once i figured out you missed out "selected:" :p

All i need now is to go to the VCS and get that bug-fix :D

Thank you very much guys


Kichik, how do i get a compiled version of the new Ui.c ?
Or don't i need it.

Sorry for being such a Newbie :(


You need a compiler for that. Joost have uploaded a compiled verison to CVS so you can use it instead of compiling yourself.


Thank you, you deserve a pay-rise :D


I love it virtlink using "INSTtype /COMPONENTSONLYONCUSTOM" and "INSTtype /NOCUSTOM" does have its uses.