Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Default radio button selection in NSIS script

Tags:

nsis

In my installer I have 2 options displayed as radio button. Update and Install. I want update option is selected by default. What option should I use with NSD_CreateRadioButton so that update is selected by default? Now, none is selected in my case.

${NSD_CreateRadioButton} 30% 50% 100% 20 "Install"
pop $1
${IfThen} $InstallType == INSTALL ${|} ${NSD_Check} $1 ${|}
${NSD_CreateRadioButton} 30% 60% 100% 20 "Update"
pop $2
like image 698
RotatingWheel Avatar asked Oct 19 '25 04:10

RotatingWheel


1 Answers

You are on the right track, you just need to simulate a click on the radio-button that you want to be the default:

!include nsDialogs.nsh
Page Custom MyPageCreate
Page InstFiles

Function MyPageCreate
nsDialogs::Create 1018
Pop $0
${NSD_CreateRadioButton} 30% 50% 100% 20 "Install"
pop $1
${NSD_CreateRadioButton} 30% 60% 100% 20 "Update"
pop $2
${If} $InstallType == INSTALL
    ${NSD_Check} $1 ; Select Install radio
${Else}
    ${NSD_Check} $2 ; Select Update radio
${EndIf}
nsDialogs::Show
FunctionEnd
like image 56
Anders Avatar answered Oct 22 '25 00:10

Anders