Archive: How set condition of the controls?


How set condition of the controls?
There is a page custom with one CheckBox and two labels, two password fields.
If CheckBox checked then labels and fields enable, if unchekced - disable.

All works perfectly, but when I press Next button and then return on my page (press Back button) - conditions of the controls don't save, program get it from the .ini file everytime on show page custom.

I change .ini file in leave fuction, but it don't work:

Function LeaveCustomB
!insertmacro MUI_INSTALLOPTIONS_READ $0 "${PAGE_PASSWORD}" "${SECTION_SETTINGS}" "State"
StrCmp $0 0 validate ; Next button
StrCmp $0 ${ID_FLD_PROTECTION_MODE} gotoProtection ;
Abort

gotoProtection:
; [Get Password protection mode]
!insertmacro MUI_INSTALLOPTIONS_READ ${TEMP} "${PAGE_PASSWORD}" "${FLD_PROTECTION_MODE}" "State"

; [Get HWND current page of installation]
FindWindow $hwnd "#32770" "" $HWNDPARENT

; [Enable/Disable Password label]
GetDlgItem ${TEMP_2} $hwnd ${ITEM_LBL_PASSWORD}
EnableWindow ${TEMP_2} ${TEMP}

; [Enable/Disable Password field]
GetDlgItem ${TEMP_2} $hwnd ${ITEM_PASSWORD}
EnableWindow ${TEMP_2} ${TEMP}
IntCmp ${TEMP} 0 gotoNextCtl
; [Set focus on specified control]
;SendMessage $hwnd ${WM_NEXTDLGCTL} ${TEMP} 1
SendMessage $hwnd ${WM_NEXTDLGCTL} 0 0 ; Set focus on next control (Password field)

gotoNextCtl:
; [Enable/Disable Confirmation Password label]
GetDlgItem ${TEMP_2} $hwnd ${ITEM_LBL_CONFIRMATION_PASSWORD}
EnableWindow ${TEMP_2} ${TEMP}

; [Enable/Disable Confirmation Password field]
GetDlgItem ${TEMP_2} $hwnd ${ITEM_CONFIRMATION_PASSWORD}
EnableWindow ${TEMP_2} ${TEMP}

;;;;;;;;;;;;;;;;;;
IntCmp ${TEMP} 0 gotoNotEnable
; [Enable labels and fields password and confirmation password]
!insertmacro MUI_INSTALLOPTIONS_WRITE "${PAGE_PASSWORD}" "${LBL_PASSWORD}" "Flags" ""
!insertmacro MUI_INSTALLOPTIONS_READ ${TEMP} "${PAGE_PASSWORD}" "${LBL_PASSWORD}" "Flags"
MessageBox MB_OK ${TEMP}
!insertmacro MUI_INSTALLOPTIONS_WRITE "${PAGE_PASSWORD}" "${FLD_PASSWORD}" "Flags" ""
!insertmacro MUI_INSTALLOPTIONS_WRITE "${PAGE_PASSWORD}" "${LBL_CONFIRMATION_PASSWORD}" "Flags" ""
!insertmacro MUI_INSTALLOPTIONS_WRITE "${PAGE_PASSWORD}" "${FLD_CONFIRMATION_PASSWORD}" "Flags" ""

gotoNotEnable:
!insertmacro MUI_INSTALLOPTIONS_WRITE "${PAGE_PASSWORD}" "${LBL_PASSWORD}" "Flags" "DISABLED"
!insertmacro MUI_INSTALLOPTIONS_WRITE "${PAGE_PASSWORD}" "${FLD_PASSWORD}" "Flags" "DISABLED"
!insertmacro MUI_INSTALLOPTIONS_WRITE "${PAGE_PASSWORD}" "${LBL_CONFIRMATION_PASSWORD}" "Flags" "DISABLED"
!insertmacro MUI_INSTALLOPTIONS_WRITE "${PAGE_PASSWORD}" "${FLD_CONFIRMATION_PASSWORD}" "Flags" "DISABLED"

;;;;;;;;;;;;;;;;;;

Abort

validate:
!insertmacro MUI_INSTALLOPTIONS_READ ${TEMP} "${PAGE_PASSWORD}" "${FLD_PASSWORD}" "State"
!insertmacro MUI_INSTALLOPTIONS_READ ${TEMP_2} "${PAGE_PASSWORD}" "${FLD_CONFIRMATION_PASSWORD}" "State"

StrCmp ${TEMP} ${TEMP_2} done
MessageBox MB_OK|MB_ICONSTOP "Please, check password."
Abort

done:
FunctionEnd

How I can do it?

Thank you


I can't find anything wrong. Maybe if you can attach a complete example which can be compiled it'll be easier to spot.