Archive: disabling the next button


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


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

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


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.


This is part of a code to disable a control is on the manual:

GetDlgItem $0 $HWNDPARENT 1
EnableWindow $0 0

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


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


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 ;)


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


As far as loading license at runtime goes, checkout
http://nsis.sourceforge.net/CustomLicense_plug-in
and
http://forums.winamp.com/showthread....12#post2316912


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


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?


Using my code in the thread I linked to should work with RTF