nsis - Unselection Mutually exclusive files -
have 2 sectiongroup
s 3 sections in each. going add more later on. have far able select 1 , 1 section in each group. able unselect afterwards, nothing in group selected.
code:
strcpy $buttongroup1 0 strcpy $buttongroup2 0 sectiongroup "select freight engine replacement mod" fer00 section /o "alaska railroad, arr" fer01 setoutpath "$instdir" setoverwrite ifnewer file "mods\fe rep\vdk fe rep emd e9 arr.dat" sectionend section /o "green burlington norhtern, bn1" fer02 setoutpath "$instdir" setoverwrite ifnewer file "mods\fe rep\vdk fe rep emd e9 bn1.dat" sectionend section /o "burlington northern exclusive, bn2" fer03 setoutpath "$instdir" setoverwrite ifnewer file "mods\fe rep\vdk fe rep emd e9 bn2.dat" sectionend sectiongroupend sectiongroup "select steam engine replacement mod" ser00 section /o "alaska railroad, arr" ser01 setoutpath "$instdir" setoverwrite ifnewer file "mods\se rep\vdk se rep emd e9 arr.dat" sectionend section /o "green burlington norhtern, bn1" ser02 setoutpath "$instdir" setoverwrite ifnewer file "mods\se rep\vdk se rep emd e9 bn1.dat" sectionend section /o "burlington northern exclusive, bn2" ser03 setoutpath "$instdir" setoverwrite ifnewer file "mods\se rep\vdk se rep emd e9 bn2.dat" sectionend sectiongroupend ; section descriptions !insertmacro mui_function_description_begin !insertmacro mui_description_text ${fer00} "select freight engine replacement mod (fe rep)." !insertmacro mui_description_text ${fer01} "installs alaska railroad freight engine replacement mod (arr fe rep)." !insertmacro mui_description_text ${fer02} "installs green burlington northern freight engine replacement mod (bn1 fe rep)." !insertmacro mui_description_text ${fer03} "installs burlington northern exclusive freight engine replacement mod (bn2 fe rep)." !insertmacro mui_description_text ${ser00} "select steam engine replacement mod (se rep)." !insertmacro mui_description_text ${ser01} "installs alaska railroad steam engine replacement mod (arr se rep)." !insertmacro mui_description_text ${ser02} "installs green burlington northern steam engine replacement mod (bn1 se rep)." !insertmacro mui_description_text ${ser03} "installs burlington northern exclusive steam engine replacement mod (bn2 se rep)." !insertmacro mui_function_description_end ; code mutually exclusive files. function .oninit strcpy $buttongroup1 0 strcpy $buttongroup2 0 ; strcpy $1 ${fer01} ; option 1 default functionend function .onselchange push $2 strcpy $2 ${sf_selected} sectiongetflags ${fer01} $0 intop $2 $2 & $0 sectiongetflags ${fer02} $0 intop $2 $2 & $0 sectiongetflags ${fer03} $0 intop $2 $2 & $0 sectiongetflags ${fer04} $0 intop $2 $2 & $0 strcmp $2 0 skip1 sectionsetflags ${fer01} 0 sectionsetflags ${fer02} 0 sectionsetflags ${fer03} 0 sectionsetflags ${fer04} 0 skip1: pop $2 !insertmacro startradiobuttons $buttongroup1 !insertmacro radiobutton ${fer01} !insertmacro radiobutton ${fer02} !insertmacro radiobutton ${fer03} !insertmacro radiobutton ${fer04} !insertmacro endradiobuttons push $2 strcpy $2 ${sf_selected} sectiongetflags ${fer01} $0 intop $2 $2 & $0 sectiongetflags ${fer02} $0 intop $2 $2 & $0 sectiongetflags ${fer03} $0 intop $2 $2 & $0 sectiongetflags ${fer04} $0 intop $2 $2 & $0 strcmp $2 0 skip2 sectionsetflags ${ser01} 0 sectionsetflags ${ser02} 0 sectionsetflags ${ser03} 0 sectionsetflags ${ser04} 0 skip2: pop $2 !insertmacro startradiobuttons $buttongroup1 !insertmacro radiobutton ${ser01} !insertmacro radiobutton ${ser02} !insertmacro radiobutton ${ser03} !insertmacro radiobutton ${ser04} !insertmacro endradiobuttons functionend
page components page instfiles sectiongroup /e "g1" gid_1 section /o "1.1" sid_1_1 sectionend section /o "1.2" sid_1_2 sectionend section /o "1.3" sid_1_3 sectionend sectiongroupend sectiongroup /e "g2" gid_2 section /o "2.1" sid_2_1 sectionend section /o "2.2" sid_2_2 sectionend section /o "2.3" sid_2_3 sectionend sectiongroupend !include sections.nsh !include logiclib.nsh !macro radiogroupornone_selchange gid sidf sidl push $0 push $1 push $2 push $3 var /global rgon_${gid}_sid strcpy $2 0 ${for} $1 ${sidf} ${sidl} ${if} ${sectionisselected} $1 intop $2 $2 + 1 ${endif} ${next} ${ifthen} $2 u< 2 ${|} strcpy $rgon_${gid}_sid 0 ${|} strcpy $2 0 strcpy $3 0 ${for} $1 ${sidf} ${sidl} ${if} ${sectionisselected} $1 ${if} $rgon_${gid}_sid = $1 sectiongetflags $1 $0 intop $0 $0 & ${section_off} sectionsetflags $1 $0 ${else} intop $2 $2 + 1 strcpy $3 $1 ${endif} ${endif} ${next} strcpy $rgon_${gid}_sid $3 ${if} $2 u> 1 sectiongetflags ${gid} $0 intop $0 $0 & ${section_off} sectionsetflags ${gid} $0 strcpy $rgon_${gid}_sid 0 ${endif} pop $3 pop $2 pop $1 pop $0 !macroend function .onselchange !insertmacro radiogroupornone_selchange ${gid_1} ${sid_1_1} ${sid_1_3} !insertmacro radiogroupornone_selchange ${gid_2} ${sid_2_1} ${sid_2_3} functionend
Comments
Post a Comment