- NSIS Discussion
- disabling the next button
Archive: disabling the next button
sfranklin
8th November 2004 17:15 UTC
disabling the next button
Hi,
this has been raised a few times, so appologies for the duplication, but i cant make sense of most of the replies.
I need to make two pages which have behaviour like the license screen in the modern UI, i.e. you have to tick a box to show you agree before the next button is enabled.
Can anyone tell me how i would go about enabling and disabling the next button
thanks for your help
Afrow UK
8th November 2004 18:48 UTC
It's not possible to actually 'gray' the button out, but you can stop user's exiting a page by calling 'Abort' in the leave function.
Example:
Page Custom myPageFunction myLeaveFunction
Function myLeaveFunction
; read check-box State
ReadINIStr $R0 "$PLUGINSDIR\ioFile.ini" "Field 3" "State"
StrCmp $R0 1 +2 ; check-box is checked?
Abort ; it is, so don't leave this damn page!
FunctionEnd
It might need some adaptation, but the general idea is there :)
-Stu
Anders
9th November 2004 06:10 UTC
it is actually possible, using the NOTIFY flag on the checkbox item in the installoptions .ini file
then enable/disable as needed in the Leave function for the custom page
sfranklin
9th November 2004 07:54 UTC
i was hoping to grey the box out, at the moment i have it working using the validate function, but there is nothing to suggest that the button isnt working for any particular reason, i.e. its not disabled.
I suppose i could put a message box up but that seems messy. It would look more standard if it worked the same was as the EULA page.
deguix
9th November 2004 11:24 UTC
This is part of a code to disable a control is on the manual:
GetDlgItem $0 $HWNDPARENT 1
EnableWindow $0 0
sfranklin
9th November 2004 12:06 UTC
thanks, with a little pointer in the right direction i managed to sort this out.
For anyone else who wants to do the same this is how i did it:
In this custom page, field 2, is the checkbox
page custom CustomPage1 ValidateCustomPage1
Function RemoveDongle
!insertmacro MUI_INSTALLOPTIONS_READ $R0 ".\CustomPage1 .ini" "Field 2" "State"
FindWindow $R1 "#32770" "" $HWNDPARENT
GetDlgItem $R1 $HWNDPARENT 1
EnableWindow $R1 $R0
!insertmacro MUI_INSTALLOPTIONS_DISPLAY ".\CustomPage1.ini"
FunctionEnd
Function ValidateCustomPage1
!insertmacro MUI_INSTALLOPTIONS_READ $R0 ".\CustomPage1.ini" "Field 2" "State"
FindWindow $R1 "#32770" "" $HWNDPARENT
GetDlgItem $R1 $HWNDPARENT 1
EnableWindow $R1 $R0
!insertmacro MUI_INSTALLOPTIONS_READ $R2 ".\CustomPage1.ini" "Settings" "State"
StrCmp $R2 "2" +1 validate
Abort
validate:
StrCmp $R0 "0" +1 ok
Abort
ok:
FunctionEnd
thanks again
Afrow UK
9th November 2004 18:44 UTC
Ah that's interesting. I was never able to do that ever before (no matter how hard I tried!)
I might incorporate this into some things now :)
-Stu
sfranklin
10th November 2004 11:11 UTC
just as a minor correction to the code above, the function name RemoveDongle should infact be CustomPage1.
But im sure you would have worked that out ;)
jrenbaum
16th March 2010 03:27 UTC
I am relatively new to nsis and am also trying to add a print button to our license agreement page. I am having problems getting my custom page to display our license agreement text. When using the default
!insertmacro MUI_PAGE_LICENSE "${LICENSE_FILE}"
approach the text shows up fine even with formatting and copywrite symbols. However, when I try to have my custom page display text it gets mangled when I use:
!define /file LICENSE_TEST ${LICENSE_FILE}
Formatting issues abound and everything is written to one line. I've tried the nsDialogs approach as well, but that did not work for me either. I've tried to read the file line by I must be missing some basic method of displaying the text from a file.
Any suggestions on how to read our rather long license agreement into the installer and display it on the custom page would be greatly appreciated.
Thanks,
Jay
jrenbaum
16th March 2010 20:19 UTC
Anders,
I was able to get the CustomLicense_plug-in to work, but only to display a license file which already works with MUI_PAGE_LICENSE. Seems like the same thing to me. I want to be able to modify this page by adding a print button. How do I incorporate this plugin into an existing custom page using InstallOptions?
Jay
Jay
jrenbaum
18th March 2010 19:55 UTC
OK, I now have the page working as desired (including the print button) using the CustomLicense plugin and nsDialogs rather than InstallOptions. However, when using this approach for a different project that has a .rtf EULA the display of the EULA is not formatted. This does get formatted and displayed correctly when using MUI_PAGE_LICENSE.
Is there any solution to this problem that doesn't involve getting rid of the CustomLicense plugin or nsDialogs other than saving the .rtf file as .txt?
Anders
18th March 2010 20:20 UTC
Using my code in the thread I linked to should work with RTF