Skip to content
⌘ NSIS Forum Archive

SectionSetFlags doesn't set the correct InstType mode

19 posts

Konrad#

SectionSetFlags doesn't set the correct InstType mode

If I call SectionSetFlags to select/deselect items from the MUI_CUSTOMFUNCTION_COMPONENTS_LEAVE function and then call Abort to stay at the components page, it'll set the correct selection, but won't set the correct install-type from the combo-box according to the new selection! Seems to be a bug...
kichik#
Does it change the install type in the combo-box to something wrong or just doesn't change it?
Guest#
In .onInit I read from registry installed sections & SectionSetFlags sets component page contents.
But combo-box shows always the first install type ("Full" for example) even if selected components are for "Custom" type or other.
glory_man#
On initalization I check if my software installed or not. If not - I use SetCurInstType 0 ("Full"). If yes - use script written by THRaSH from http://nsis.sourceforge.net/archive/...instances=0,64 to implement Add/Remove functionality in the installer. But now even if selected components are for "Custom" type, combo-box shows "Full".
Users can choose 5 from 10 components (for example) which do not approach under one of InstallTypes. What I shall have to do?
kichik#
If the first install type is "Full", you got what you asked for.

If you want to choose the "Custom" install type, use:
SetCurInstType ${NSIS_MAX_INST_TYPES}
glory_man#
Installer does not know what InstallType the user has chosen during the previous installation. It can read only structure of components.
Probably I cannot explain on Eglish.
glory_man#
OK. I use GetCurInstType. Result is stored in variable. What can I do whith variable? Write it in registry; on initalization read it and SetCurInstType <variable>. But in this case it is manual work.
I thought that the NSIS itself can define IstallType on the chosen components. In fact when I on components page choose elements - IstallType define automatically. For this purpose I should define only what element where enters using SectionIn.
kichik#
It should figure out which install type to choose according to the selected components, but currently it doesn't. It will be fixed. For now, you should use GetCurInstType and SetCurInstType.
glory_man#
The original issue is fixed in the latest CVS version.
There is no need to use GetCurInstType and SetCurInstType for refresh InstallType?
kichik#
Next month. You can download it from CVS, compile and test. If you don't want to mess with CVS, there's a snapshot which updates every couple of hours. It doesn't contain updated compiled binaries, just the new source code.
Guest#
I got a question about CVS wut it does??

Glory_man if you set flags on Component Leave, wut would happened when you click back like Start menu back Directory Page to Component page .....

I set flags on first .OnInit.... i have to write regDWORD
into Regsitry... look like this

Section Section1
WriteRegDWORD "REG_KEY" "section1" 1
WriteRegDWORD "REG_KEY" "section2" 0
WriteRegDWORD "REG_KEY" "section3" 0
SectionEnd

Section Section2
WriteRegDWORD "REG_KEY" "section2" 1
SectionEnd

Section Section3
WriteRegDWORD "REG_KEY" "section3" 1
SectionEnd

Function .Oninit
ReadRegStr $0 "REG_KEY" "section1"
SectionSetFlags ${section1} $0
ReadRegStr $0 "REG_KEY" "section2"
SectionSetFlags ${section1} $0
ReadRegStr $0 "REG_KEY" "section3"
SectionSetFlags ${section1} $0
...
SetCurInstType...
Functionend

That work i think
glory_man#
if you set flags on Component Leave
If you look at THraSH's exapmle you will see that sections flags are set in .onInit-function -
!insertmacro SectionList "InitSection"
After components choosing and istallation (in -FinishComponents section) I write components status to registry. After that - finish page displayed where I could not press Back-button.
All work fine.
Generally speaking I correspond with THraSH. This example will be updated in the near future.