Archive: Next Button or something else?


Next Button or something else?
Hello,
I am having problem with the behaviour of the custom dialog box I have created. This dialog box displays 'Next' button disabled until you click on CheckBox. Selecting Check box make the 'Next' button enabled. Which works perfectly fine until you click on 'Next'. Once you click 'Next' and again if I come back to the same page by clicking 'Back' then Clicking checkbox take me to the
previous screen Where it should just enable or disable the Next button. Following is the code..Can someone help me to sort the problem. Thanks, Monika

Function .onInit
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "Warning.ini"
FunctionEnd

Function WarningPage
!insertmacro MUI_INSTALLOPTIONS_READ $CHK_CONTINUESTATE "Warning.ini" "Field 2" "State"

;Before Displaying the page retain the settings to display next button enabled/disabled accordingly.

GetDlgItem $NEXTWINDOW $HWNDPARENT 1
EnableWindow $NEXTWINDOW 0

StrCmp $CHK_CONTINUESTATE "1" +3
EnableWindow $NEXTWINDOW 0
Goto +2
EnableWindow $NEXTWINDOW 1


!insertmacro MUI_INSTALLOPTIONS_WRITE "Warning.ini" "Field 1" "Text" $(WARNING_MAIN_TEXT)
!insertmacro MUI_INSTALLOPTIONS_WRITE "Warning.ini" "Field 2" "Text" $(WARNING_CONTINUE)


!insertmacro MUI_INSTALLOPTIONS_DISPLAY "Warning.ini"

FunctionEnd

Function WarningPage_Leave

!insertmacro MUI_INSTALLOPTIONS_READ $CHK_CONTINUE "Warning.ini" "Settings" "State"


StrCmp $CHK_CONTINUE 0 ClickNextBtn
StrCmp $CHK_CONTINUE 2 NextBtnState


NextBtnState:
!insertmacro MUI_INSTALLOPTIONS_READ $CHK_CONTINUESTATE "Warning.ini" "Field 2" "State"

GetDlgItem $NEXTWINDOW $HWNDPARENT 1

StrCmp $CHK_CONTINUESTATE "1" +3
EnableWindow $NEXTWINDOW 0
Goto +2
EnableWindow $NEXTWINDOW 1

Abort


ClickNextBtn:


FunctionEnd


You cannot disable the Next button with InstallOptions unfortunately. However, what you can do is stop the user from leaving the dialogue.

E.g.


Function CustomDialogue
Push $R0
Top:
InstallOptions::dialog "dlg.ini"
Pop $R0
StrCmp $R0 next 0 +3
ReadINIStr $R0 "dlg.ini" "Field 1" "State"
StrCmp $R0 0 Top ;if checkbox unchecked, go back
Pop $R0
FunctionEnd


-Stu

monidon:
Attach a reduced, but compilable version of your script.
Then it will be easier to help you.

Afrow:
The code that monidon has included:


GetDlgItem $NEXTWINDOW $HWNDPARENT 1
EnableWindow $NEXTWINDOW 0

actually does disable the "Next" button.
Try it and see.

Thanks for your replies.
What Iceman_K saying is right, I can enable disable Next button with the code I posted. Only problem I am facing is that when I check the checkbox which makes the Next button enabled, I go to next page and come back to change my settings by clicking the checkbox again takes me to previous page. Where it should just disable the button again.
Can't understand why this is happening.
Any help would be appriciated.
Thanks,
Monika


Again: attach a compilable version of your script demonstrating the problem.
Maybe then someone will be able to help you.


Now I have attached sample NSIS script which I wrote to demonstrate what is happening. Please have a look..can download and try running it to see its behaviour. YOu will need DynamicDlg2.ini file as well. Which includes the following fields
************************************************
[Settings]
NumFields=3

[Field 1]
Type=Groupbox
Text="This is a group box..."
Left=0
Right=-1
Top=0
Bottom=-4

[Field 2]
Type=Checkbox
Text=Enable/Disable Next
Flags=NOTIFY
State=0
Left=10
Right=100
Top=17
Bottom=25

[Field 3]
Type=Label
Text=This is just an example script
Left=9
Right=436
Top=84
Bottom=102
*******************************************

Thanks and any help will be appriciated.
Monika


I don't know what to tell you.... it works perfectly for me.
Are you sure you have all the latest CVS updates?


Hello Iceman_K,
What you were saying is right. Updating latest CVS files made my program run perfectly fine. But I can't really use this update for building our product release as the code is not tested and it won't be good idea to use updated CVS files for building release product.

But thanks a lot for your help. It did helped me and now atleast I know that there is a solution. So I will wait until NSIS release next version with this bug fix.

Thanks once again,
Monika


That will probably be some time.
I myself would rather use the CVS version than the 'stable' release. It's been often that the last 'stable' release has had more bugs than the CVS because the CVS has had the bug fixes implemented.

-Stu