Old 8th November 2004, 17:15   #1
sfranklin
Junior Member
 
Join Date: Jul 2004
Posts: 40
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
sfranklin is offline   Reply With Quote
Old 8th November 2004, 18:48   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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:
code:
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
Afrow UK is offline   Reply With Quote
Old 9th November 2004, 06:10   #3
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,320
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

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 9th November 2004, 07:54   #4
sfranklin
Junior Member
 
Join Date: Jul 2004
Posts: 40
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.
sfranklin is offline   Reply With Quote
Old 9th November 2004, 11:24   #5
deguix
Major Dude
 
deguix's Avatar
 
Join Date: Dec 2002
Location: Everett - MA, USA
Posts: 1,354
Send a message via ICQ to deguix
This is part of a code to disable a control is on the manual:

code:
GetDlgItem $0 $HWNDPARENT 1
EnableWindow $0 0


My Wiki Pages

Working now on:
New projects. (language: any)
deguix is offline   Reply With Quote
Old 9th November 2004, 12:06   #6
sfranklin
Junior Member
 
Join Date: Jul 2004
Posts: 40
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
sfranklin is offline   Reply With Quote
Old 9th November 2004, 18:44   #7
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Old 10th November 2004, 11:11   #8
sfranklin
Junior Member
 
Join Date: Jul 2004
Posts: 40
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
sfranklin is offline   Reply With Quote
Old 16th March 2010, 02:27   #9
jrenbaum
Junior Member
 
Join Date: Feb 2007
Posts: 13
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 is offline   Reply With Quote
Old 16th March 2010, 03:59   #10
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,320
As far as loading license at runtime goes, checkout
http://nsis.sourceforge.net/CustomLicense_plug-in
and
http://forums.winamp.com/showthread....12#post2316912

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 16th March 2010, 19:19   #11
jrenbaum
Junior Member
 
Join Date: Feb 2007
Posts: 13
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 is offline   Reply With Quote
Old 18th March 2010, 18:55   #12
jrenbaum
Junior Member
 
Join Date: Feb 2007
Posts: 13
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?
jrenbaum is offline   Reply With Quote
Old 18th March 2010, 19:20   #13
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,320
Using my code in the thread I linked to should work with RTF

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump