Function MyCustomLeave push $0 ; abort flag push $1 ; page state push $2 ; radio button 3 state push $3 ; HWND push $4 ; text field value StrCpy $0 1 # Read the states ReadINIStr $1 "licinfodlg.ini" "Settings" "State" ReadINIStr $2 "licinfodlg.ini" "Field 3" "State" # What was clicked? ${If} $1 != 0 ; get the HWND of the text field ReadINIStr $3 "licinfodlg.ini" "Field 4" "HWND" ; enable/disable based on state of radio button 3 ${If} $2 = 1 ; radio button selected so enable the field WriteINIStr "licinfodlg.ini" "Field 4" "Flags" "" EnableWindow $3 1 ${Else} ; not selected, so disable field WriteINIStr "licinfodlg.ini" "Field 4" "Flags" "DISABLED" EnableWindow $3 0 ${EndIf} ${Else} ; next button selected ${If} $2 != 1 StrCpy $0 0 ${Else} ReadINIStr $3 "licinfodlg.ini" "Field 4" "State" ${If} "$3" == "" MessageBox MB_OK "You must enter a value" ${Else} StrCpy $0 0 ${EndIf} ${EndIf} # now, clean up and exit pop $4 pop $3 pop $2 pop $1 ${If} $0 = 1 pop $0 abort ${Else} pop $0 ${EndIf} FunctionEnd