Archive: Radiobutton - enable/disable, "memory"


Radiobutton - enable/disable, "memory"
Hi.

I couldn't find info about how to enable disabled radiobutton and how to implement "memory" scheme from tutorial.

Below is my code:

OutFile "radiobtn.exe"
!include mui2.nsh

Page custom nsDialogsPage
!insertmacro MUI_PAGE_INSTFILES

RequestExecutionLevel User

Var Option1
Var Option2
Var Option1State
Var Option2State
var ChosenOption

Function nsDialogsPage
nsDialogs::Create 1018
Pop $0

${If} $0 == error
Abort
${EndIf}

${NSD_CreateRadioButton} 10% 30% 40% 20% "1.install"
Pop $Option1
${NSD_AddStyle} $Option1 ${WS_GROUP}|${WS_TABSTOP}
${NSD_OnClick} $Option1 RadioClick
IfFileExists "C:\Orcl" 0 Option1
${NSD_AddStyle} $Option1 ${WS_DISABLED}
Option1:
System::Call "user32::GetWindowLong(i $Option1, i ${GWL_STYLE}) i .r0"
intop $Option1State $0 & ${WS_DISABLED}

${NSD_CreateRadioButton} 10% 70% 50% 20% "2. Upgrade"
Pop $Option2
${NSD_OnClick} $Option2 RadioClick
IfFileExists "C:\Orcl" Option2 0
${NSD_AddStyle} $Option2 ${WS_DISABLED}
Option2:
System::Call "user32::GetWindowLong(i $Option2, i ${GWL_STYLE}) i .r0"
intop $Option2State $0 & ${WS_DISABLED}

${If} $Option1State == 0
${NSD_Check} $Option1
StrCpy $ChosenOption $Option1
${elseIf} $Option2State == 0
${NSD_Check} $Option2
StrCpy $ChosenOption $Option2
${endIf}

nsDialogs::Show

FunctionEnd

Function RadioClick
Pop $ChosenOption
FunctionEnd
Section
SectionEnd



I want to have back option with memorized selection and second, how to enable once disabled radiobutton? There is no WS_ENABLED (opposed to WS_DISABLED).


well, setting WS_DISABLED after the window has been created is not the "correct" way to do it, use EnableWindow for both


OK. Corrected. Thank you.
Now I have only 1 problem left.