Archive: Disable a control on a custom Page


Disable a control on a custom Page
This may seem very trivial, but I have searched the forum and cannot see how this is done..

I have a custom form with a parent checkbox and a child checkbox.

I want to have it so if ther parent is ticked, the child checkboxes will be disabled, and if it's unticked then they will be enabled.

I have used the NOTIFY flag on the parent checkbox, and have code for checking that it is ticked and then disabling the child checkbox.

What I am failing with is just going back to that same custom page with the updated enabled/disabled child checkbox.

If I have this:


!insertmacro MUI_INSTALLOPTIONS_READ $R3 "GeneralDetails.ini" "Settings" "State"

${if} $R3 == "15"
${if} $R5 == "1" ; parent checkbox enabled
!insertmacro MUI_INSTALLOPTIONS_WRITE "GeneralDetails.ini" "Field 9" "Flags" "DISABLED" ; disable child
${Else}
!insertmacro MUI_INSTALLOPTIONS_WRITE "GeneralDetails.ini" "Field 9" "Flags" "" ; enable child
${EndIf}
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "GeneralDetails.ini"
${EndIf}

Am I missing an Abort command or a different MUI_INSTALLOPTIONS macro?

Thanks in advance!

You are missing a few things. First, you must call Abort to go back from the leave function to the page. You shouldn't call MUI_INSTALLOPTIONS_DISPLAY again, that'd cause nothing but trouble. Second, you can't write new data to the INI file, it won't be read. You must update the controls using EnableWindow. Third, you've missed Examples\InstallOptions\testnotify.nsi which shows it all.


Thank you! I knew I was overlooking something but could just not see it. :(