Boyito
3rd January 2007 18:18 UTC
Component Select Verification Back!!
Hi
In my 1st post ive got a solution reading this thread
http://forums.winamp.com/showthread....hreadid=261059
Ive put a similar code in my installer but only checks well the first component.
Here a part of code
-------------------------
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE ComponentsLeave
!insertmacro MUI_PAGE_COMPONENTS
Function ComponentsLeave
SectionGetFlags Sec01 $R0
IntOp $R0 $R0 & ${SF_SELECTED}
StrCmp $R0 1 clSkip
SectionGetFlags Sec02 $R1
IntOp $R1 $R1 & ${SF_SELECTED}
StrCmp $R1 1 clSkip
MessageBox MB_OK|MB_ICONEXCLAMATION 'Please select a component!'
Abort
clSkip:
FunctionEnd
-------------------------
The result of SectionGetFlags Sec01 if this section es checked is 9 and 8 if its not, but SectionGetFlags Sec02 always returns 8
Where is the problem??
TIA
Red Wine
3rd January 2007 18:36 UTC
outfile 'Components.exe'
InstallDir '$PROGRAMFILES\Components Test'
InstType 'Typical'
InstType 'Full'
!include "Sections.nsh"
!include 'mui.nsh'
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE LeaveComponents
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_LANGUAGE "English"
section "!Required Section"
SectionIn RO
SetOutPath '$INSTDIR'
SectionEnd
Section "Components 1" sec01
SectionIn 1 2
SetOutPath '$INSTDIR\Component 1'
SectionEnd
Section /o "Components 2" sec02
SectionIn 2
SetOutPath '$INSTDIR\Component 2'
SectionEnd
Section /o "Components 3" sec03
SectionIn 2
SetOutPath '$INSTDIR\Component 3'
SectionEnd
Function LeaveComponents
SectionGetFlags ${sec01} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
StrCmp $R0 1 skip
SectionGetFlags ${sec02} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
StrCmp $R0 1 skip
SectionGetFlags ${sec03} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
StrCmp $R0 1 skip
SectionGetFlags 3 $R0
IntOp $R0 $R0 & ${SF_SELECTED}
StrCmp $R0 1 skip
MessageBox MB_OK|MB_ICONEXCLAMATION "Please select a Component!"
Abort
skip:
FunctionEnd
Boyito
3rd January 2007 18:48 UTC
HI RW
I dont use InstType I dont need it
I replace in my code this line
SectionGetFlags Sec01 $R0
with yours
SectionGetFlags ${sec01} $R0
And now the compiler says
1 warnings:
unknown variable/constant "{Sec01}" detected, ignoring
And still the same problem if i put this code the messagebox shows me always 8 in Sec02, ( checked or not )
Function ComponentsLeave
SectionGetFlags ${Sec01} $R0
MessageBox MB_OK ' SectionGetFlags Sec01 $R0'
IntOp $R0 $R0 & ${SF_SELECTED}
StrCmp $R0 1 clSkip
SectionGetFlags ${Sec02} $R0
MessageBox MB_OK ' SectionGetFlags Sec02 $R0'
IntOp $R0 $R0 & ${SF_SELECTED}
StrCmp $R0 1 clSkip
MessageBox MB_OK|MB_ICONEXCLAMATION 'Please select a component!'
Abort
clSkip:
FunctionEnd
Any Idea??
Red Wine
3rd January 2007 18:56 UTC
Simply compile and run my example above, compare them, so you'll find the fault.
Boyito
3rd January 2007 19:03 UTC
Ive just do it
Your sample works fine
The results numbers 8 and 9 of SectionGetFlags ${sec01} $R0 are because my sections are in bold , but this is not a problem, ive change the same in your sample and still works, ive comment the Required Section and still works, ive comment the InstType and still works!!!!
I dont konw why my code dont, and why shows me a warning
Crying :-(
Red Wine
3rd January 2007 19:12 UTC
Here is yours Boyo, probably there is a typo somewhere :-)
!include "Sections.nsh"
!include 'mui.nsh'
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE ComponentsLeave
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
Section /o "Components 1" sec01 ;section ID
SectionEnd
Section /o "Components 2" sec02 ;section ID
SectionEnd
Function ComponentsLeave
; section ID user_var_output
SectionGetFlags ${Sec01} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
StrCmp $R0 1 clSkip
; section ID user_var_output
SectionGetFlags ${Sec02} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
StrCmp $R0 1 clSkip
MessageBox MB_OK|MB_ICONEXCLAMATION 'Please select a component!'
Abort
clSkip:
FunctionEnd
Boyito
4th January 2007 14:00 UTC
RW thanks a lot again for your help
The problem was a order instructions
Ive Sections after Functions
Ive write in order like your code and everything works fine
Bye ( see you in my next post )