- NSIS Discussion
- unchecked subsection as default
Archive: unchecked subsection as default
Brummelchen
27th June 2003 12:47 UTC
unchecked subsection as default
Hi there and hello
Is it possible to have an subsection unchecked as default
eg.
section
- [x] subsection 1
- [_] subsection 2
Additional:
Is it possible to change the [x] for subsection 2 depending on existing values (e.g feature was installed before (or not))
example:
on first installation subs2 is nailed, user deselected it - and on upgrade (or 2nd installation) subs2 is not nailed.
thx
Brummelchen
27th June 2003 16:53 UTC
sorry - from help
>> If the Switch /o is specified than the Section is unselected by default.
but my second question is still unanswered. is it possible?
Brummelchen
27th June 2003 17:12 UTC
I found a macro in a NSH
; Set one or more BITS in SECTION's flags.
!macro SetSectionFlag SECTION BITS
Push $R0
SectionGetFlags "${SECTION}" $R0
IntOp $R0 $R0 | "${BITS}"
SectionSetFlags "${SECTION}" $R0
Pop $R0
!macroend
; Clear one or more BITS in SECTION's flags.
!macro ClearSectionFlag SECTION BITS
Push $R0
Push $R1
SectionGetFlags "${SECTION}" $R0
IntOp $R1 "${BITS}" ~
IntOp $R0 $R0 & $R1
SectionSetFlags "${SECTION}" $R0
Pop $R1
Pop $R0
!macroend
Maybe
!insertmacro SetSectionFlag
but SECTION and BITS? how? pls tell me
can i include the text containing the macro like this without copying the macro itself to my nsi-script or is it included automatically?
!include "${NSISDIR}\include\sections.nsh"
n0On3
30th June 2003 02:09 UTC
Originally posted by Brummelchen sorry - from help
>> If the Switch /o is specified than the Section is unselected by default.
where did you get this?
4.6.1.2 Section
[/e] [section_name] [section index output]
Begins and opens a new section. If section_name is empty, omitted, or begins with a -, then it is a required section and the user will not see it, nor have the option of disabling it. If the section name is 'Uninstall', then it is a special Uninstall Section. If section index output is specified, the parameter will be !defined with the section index (that can be used for SectionSetText etc). If the section name begins with a !, the section will be displayed as bold. If /e is present, the sub sections of the section will be expanded by default.
Brummelchen
30th June 2003 03:32 UTC
NSIS Help Chapter 4 CVS from the last 3 days or before !
Section flags have to be changed if the concerning file was installed on a previos setup - normal it is unchecked due to a Web-Setup.
kichik
4th July 2003 12:43 UTC
You don't need ClearSectionFlag, you can use UnselectSection from the same file. Just so you'd know next time, the flags (BITS) are listed on the top of Sections.nsh (SF_*), and SECTION is the section id as always.
Brummelchen
4th July 2003 14:18 UTC
@kichik
man ur great :)
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE
Page custom find_xyz ; this is a normal function call
!insertmacro MUI_PAGE_COMPONENTS
...
Function find_xyz
IfFileExists $INSTDIR\xyz\xyz.exe 0 noabsfsec
absfsec:
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2
"A previous version of '${MUI_PRODUCT} xyz' was found.
$\nWould you like to install the latest version?"
IDNO noabsfsec
SectionSetFlags ${SecInfo2} 1
noabsfsec:
FunctionEnd
BTW is this the correct syntax?
SectionSetFlags ${SecInfo2} 1 <-- "1" or do i have to use other flags? (0x01)
kichik
4th July 2003 14:26 UTC
1 is the same as SF_SELECTED. There is absolutely no difference. Why would you use SectionSetFlags though? What's wrong with SelectSection?
kichik
4th July 2003 14:28 UTC
Hmm... It's not the macro. SetSectionFlags 1 to select the section should be enough but if you choose to add other flags such as bold or read only it will remove them. You should use the SelectSection macro from Sections.nsh.
Brummelchen
4th July 2003 14:33 UTC
@kichik
SF_SELECTED is synonym for "0x01" ?
> What's wrong with SelectSection?
You mean that
!insertmacro SelectSection $1
may the easier way?
if that does set flag SF_SELECTED without changing other flags (bold aso.) that would help me.
This is my first time into deep nsis :)
kichik
4th July 2003 14:41 UTC
${SF_SELECTED} is defined as 1 (or 0x01, same thing). It's the exact same thing, but SF_SELECTED's meaning is far more easier to understand than 1 ;)
Saving other flags is the exact reason to use the macro (or just its content).
Brummelchen
4th July 2003 15:01 UTC
> ${SF_SELECTED} is defined as 1
This works
IntOp $0 $0 | 1
this not
IntOp $0 $0 | ${SF_SELECTED}
I modified the routine:
;set SectionFlags to "found"
Push $0
SectionGetFlags ${SecInfo2} $0
IntOp $0 $0 | 1
SectionSetFlags ${SecInfo2} $0
Pop $0
I dont know how to work with
!insertmacro SelectSection $1
it causes errors while compiling.
kichik
4th July 2003 17:26 UTC
You have to include Sections.nsh for SF_SELECTED and the macros to be defined.
You've used $1 in the macro instead of the section. It should look like this:
!insertmacro SelectSection ${SecInfo2}
What errors do you get? If it tells you the macro wasn't found then you should add "!include Sections.nsh" to your script.
Brummelchen
4th July 2003 18:30 UTC
@kichik
> add "!include Sections.nsh" to your script.
i forgot that - now it works perfectly. THX