I am creating setup with my Custom Wizard Dialogs. I am creating Custom Wizard Dialogs for Welcome, License Agreement etc. I am facing problem with enable/disable of Next button on License Agreement dialog.

License Agreement has one check box to accept the License Agreement. First time when I do next from Welcome dialog and move to License Agreement dialog the Next button is disabled and check box is unchecked. Next button is getting enable/disable properly When I check/uncheck checkbox. Problem start when I do back from License Agreement dialog. When I do back from License Agreement and again next from Welcome dialog, the next button on License Agreement is always enable.

I am using this code:

Set Variable %LICENSE_ACCEPTED% to "0"

! The Wizard Loop displays the dialog screens that the user sees in the installation
Define Wizard Dialog "WELCOME" (Custom Wizard Dialog)
Define Wizard Dialog "LICENSE" (Custom Wizard Dialog)
Define Wizard Dialog "OPTIONS" (Custom Wizard Dialog)
Define Wizard Dialog "READYTOINSTALL" (Custom Wizard Dialog)

Loop Wizard (Abort Dialog Active)
If %_SB_DIALOGID% Equals "$LICENSE$" Then
If %LICENSE_ACCEPTED% Equals "1" Then
Enable ControlID "$NEXT_BUTTON$"
End
If %LICENSE_ACCEPTED% Equals "0" Then
Disable ControlID "$NEXT_BUTTON$"
End
End
End


Please help.