megane68
Иначе бы не прислал. После я его оттуда уберу - он у меня вечно в доработке по мере надобности.
Иначе бы не прислал. После я его оттуда уберу - он у меня вечно в доработке по мере надобности.
Нужно, чтобы при выборе SEC03 или SEC04 секции, как обязаловка включалась секция SEC02.
нащупал потихоньку логику.
outfile onSelChange-test.exe
!include "MUI2.nsh"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "Russian"
Section /o "sec02" SEC02
SectionEnd
Section /o "sec03" SEC03
SectionEnd
Section /o "sec04" SEC04
SectionEnd
Function .onSelChange
SectionGetFlags ${SEC03} $3
SectionGetFlags ${SEC04} $4
${If} $3 == 1
${OrIf} $4 == 1
SectionSetFlags ${SEC02} 1
${EndIf}
FunctionEnd
Name SectionDependency
OutFile SectionDependency.exe
Var IndependentSectionState
Page Components
!include Sections.nsh
Section "Section 1" SEC01
SetOutPath "$INSTDIR\"
SectionIn RO
SectionEnd
Section "Section 2" SEC02
SetOutPath "$INSTDIR\"
SectionIn RO
SectionEnd
SubSection "Субсекция 1" SUBSEC01
Section "Section 3" SEC03
SetOutPath "$INSTDIR\"
SectionEnd
Section /o "Section 4" SEC04
SetOutPath "$INSTDIR\"
SectionEnd
Section /o "Section 5" SEC05
SetOutPath "$INSTDIR\"
SectionEnd
SubSectionEnd
SubSection "Субсекция 2" SUBSEC02
Section "Section 6" SEC06
SetOutPath "$INSTDIR\"
SectionEnd
Section /o "Section 7" SEC07
SetOutPath "$INSTDIR\"
SectionEnd
Section /o "Section 8" SEC08
SetOutPath "$INSTDIR\"
SectionEnd
SubSectionEnd
Function .onInit
# This is necessary otherwise SEC03 won't be selectable for the first time you click it.
SectionGetFlags ${SEC03} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
StrCpy $IndependentSectionState $R0
SectionGetFlags ${SEC06} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
StrCpy $IndependentSectionState $R0
FunctionEnd
Function .onSelChange
Push $R0
Push $R1
# Check if SEC03 was just selected then select SEC04 and SEC05.
SectionGetFlags ${SEC03} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
StrCmp $R0 $IndependentSectionState +3
StrCpy $IndependentSectionState $R0
Goto UnselectDependentSections
StrCpy $IndependentSectionState $R0
Goto CheckDependentSections
; # Check if SEC06 was just selected then select SEC07 and SEC08.
; SectionGetFlags ${SEC06} $R0
; IntOp $R0 $R0 & ${SF_SELECTED}
; StrCmp $R0 $IndependentSectionState +3
; StrCpy $IndependentSectionState $R0
; Goto UnselectDependentSections
; StrCpy $IndependentSectionState $R0
; Goto CheckDependentSections
; # Check if SEC06 was just selected then select SEC07 and SEC08.
; SectionGetFlags ${SEC07} $R0
; IntOp $R0 $R0 & ${SF_SELECTED}
; StrCmp $R0 $IndependentSectionState +3
; StrCpy $IndependentSectionState $R0
; Goto UnselectDependentSections
; StrCpy $IndependentSectionState $R0
; Goto CheckDependentSections
# Select SEC03 if SEC04 or SEC05 was selected.
SelectIndependentSection:
SectionGetFlags ${SEC03} $R0
IntOp $R1 $R0 & ${SF_SELECTED}
StrCmp $R1 ${SF_SELECTED} +3
IntOp $R0 $R0 | ${SF_SELECTED}
SectionSetFlags ${SEC03} $R0
StrCpy $IndependentSectionState ${SF_SELECTED}
SectionGetFlags ${SEC06} $R0
IntOp $R1 $R0 & ${SF_SELECTED}
StrCmp $R1 ${SF_SELECTED} +3
IntOp $R0 $R0 | ${SF_SELECTED}
SectionSetFlags ${SEC06} $R0
StrCpy $IndependentSectionState ${SF_SELECTED}
SectionGetFlags ${SEC04} $R0
IntOp $R1 $R0 & ${SF_SELECTED}
StrCmp $R1 ${SF_SELECTED} +3
IntOp $R0 $R0 | ${SF_SELECTED}
SectionSetFlags ${SEC04} $R0
StrCpy $IndependentSectionState ${SF_SELECTED}
SectionGetFlags ${SEC05} $R0
IntOp $R1 $R0 & ${SF_SELECTED}
StrCmp $R1 ${SF_SELECTED} +3
IntOp $R0 $R0 | ${SF_SELECTED}
SectionSetFlags ${SEC05} $R0
StrCpy $IndependentSectionState ${SF_SELECTED}
Goto End
# Were Sec3 or Sec4 just unselected?
CheckDependentSections:
SectionGetFlags ${SEC04} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
StrCmp $R0 ${SF_SELECTED} SelectIndependentSection
SectionGetFlags ${SEC05} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
StrCmp $R0 ${SF_SELECTED} SelectIndependentSection
; Goto End
SectionGetFlags ${SEC07} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
StrCmp $R0 ${SF_SELECTED} SelectIndependentSection
SectionGetFlags ${SEC08} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
StrCmp $R0 ${SF_SELECTED} SelectIndependentSection
Goto End
# Unselect Sec3 and Sec4 if Sec2 was unselected.
UnselectDependentSections:
SectionGetFlags ${SEC04} $R0
IntOp $R1 $R0 & ${SF_SELECTED}
StrCmp $R1 ${SF_SELECTED} 0 +3
IntOp $R0 $R0 ^ ${SF_SELECTED}
SectionSetFlags ${SEC04} $R0
SectionGetFlags ${SEC05} $R0
IntOp $R1 $R0 & ${SF_SELECTED}
StrCmp $R1 ${SF_SELECTED} 0 +3
IntOp $R0 $R0 ^ ${SF_SELECTED}
SectionSetFlags ${SEC05} $R0
SectionGetFlags ${SEC07} $R0
IntOp $R1 $R0 & ${SF_SELECTED}
StrCmp $R1 ${SF_SELECTED} 0 +3
IntOp $R0 $R0 ^ ${SF_SELECTED}
SectionSetFlags ${SEC07} $R0
SectionGetFlags ${SEC08} $R0
IntOp $R1 $R0 & ${SF_SELECTED}
StrCmp $R1 ${SF_SELECTED} 0 +3
IntOp $R0 $R0 ^ ${SF_SELECTED}
SectionSetFlags ${SEC08} $R0
End:
Pop $R1
Pop $R0
FunctionEnd
Page Components
!include Sections.nsh
Section "Section 1" SEC01
SetOutPath "$INSTDIR\"
SectionIn RO
SectionEnd
Section "Section 2" SEC02
SetOutPath "$INSTDIR\"
SectionIn RO
SectionEnd
SubSection "Субсекция 1" SUBSEC01
Section "Section 3" SEC03
SetOutPath "$INSTDIR\"
SectionEnd
Section /o "Section 4" SEC04
SetOutPath "$INSTDIR\"
SectionEnd
Section /o "Section 5" SEC05
SetOutPath "$INSTDIR\"
SectionEnd
SubSectionEnd
SubSection "Субсекция 2" SUBSEC02
Section "Section 6" SEC06
SetOutPath "$INSTDIR\"
SectionEnd
Section /o "Section 7" SEC07
SetOutPath "$INSTDIR\"
SectionEnd
Section /o "Section 8" SEC08
SetOutPath "$INSTDIR\"
SectionEnd
SubSectionEnd
Function .onSelChange
SectionGetFlags ${SEC04} $3
SectionGetFlags ${SEC05} $4
${If} $3 == 1
${OrIf} $4 == 1
SectionSetFlags ${SEC03} 1
${EndIf}
SectionGetFlags ${SEC07} $3
SectionGetFlags ${SEC08} $4
${If} $3 == 1
${OrIf} $4 == 1
SectionSetFlags ${SEC06} 1
${EndIf}
FunctionEnd
При выборе 5-ой секции, должны включаться 1,-ая, 2-ая, 3-яя, 4-ая,
у тебя ведь 1 и 2 секции уже всегда включены принудительно - SectionIn RO для
Или ты путаешь нумерацию секций и субсекций ?
Function .onSelChange
# Select SEC03 if SEC04 or SEC05 was selected.
SectionGetFlags ${SEC04} $3
SectionGetFlags ${SEC05} $4
${If} $3 == 1
${OrIf} $4 == 1
SectionSetFlags ${SEC03} 1
${EndIf}
# Select SEC06 if SEC07 or SEC08 was selected.
SectionGetFlags ${SEC07} $3
SectionGetFlags ${SEC08} $4
${If} $3 == 1
${OrIf} $4 == 1
SectionSetFlags ${SEC06} 1
${EndIf}
# Select SEC03, SEC04, SEC05 and SEC06 if SEC07 was selected.
SectionGetFlags ${SEC07} $4
${If} $3 == 1
${OrIf} $4 == 1
SectionSetFlags ${SEC03} 1
SectionSetFlags ${SEC04} 1
SectionSetFlags ${SEC05} 1
SectionSetFlags ${SEC06} 1
${EndIf}
FunctionEnd
!define MUI_COMPONENTSPAGE_SMALLDESC
InstType "Полный"
InstType "Минимальный"
InstType "Рекомендуемый"
Function SetFlags
${NSD_GetState} $RadioButton1 $Radio1
${NSD_GetState} $RadioButton2 $Radio2
${If} $Radio1 = 1
SectionSetFlags ${Port} 0
SectionSetFlags ${St} 1
${EndIf}
${If} $Radio2 = 1
SectionSetFlags ${St} 0
SectionSetFlags ${Port} 1
${EndIf}
FunctionEnd
Теперь надо решать вопрос с зависимостью при отмене выбора компонентов!
Мне же нужен (в частности) экспорт выборочных параметров (values).
Но этот экспорт вручную
Страницы: 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
Предыдущая тема: The Bat!