- NSIS Discussion
- Print button on the license dialog page
Archive: Print button on the license dialog page
smatte
13th October 2005 15:28 UTC
Print button on the license dialog page
I'm trying to add a print button on license page. I tried 2 differents method:
1- With "Page custom" I could add a button but the edit box that contain license is gray if I put it read only and white but selected(text in blue) if not read only.:confused:
2- Is there a way to add some fields with an ini file when using "Page license"? if I could add a field "button", it will be great for me. :D
Any hint for me?:weird:
Jnuw
13th October 2005 16:07 UTC
Sounds like you just want to allow the users to be able to print your license agreement. If that's true, simply include a txt file containing your license in your installer. Use the custom page method your were working on, and add the button (you may have to edit the position):
[Field 5]
Type=Button
Flags=NOTIFY
Text=&Print License
Left=240
Right=-10
Top=123
Bottom=137
Then in your leave function for that custom page...
Function LeaveLicensePage
ReadINIStr $0 "$PLUGINSDIR\LicensePage.ini" "Settings" "State"
StrCmp $0 5 0 +4
File /oname=$PLUGINSDIR\License.txt "License.txt"
ExecShell "print" "$PLUGINSDIR\License.txt" SW_HIDE
Abort
FunctionEnd
Hope this helps!
smatte
13th October 2005 16:14 UTC
I already did that and it work well but when the page shows up, the license text is selected. Any code to tell nsis to doesn't selected the text in my text field?
Thanks anyway.
Jnuw
13th October 2005 16:59 UTC
Well if you use the following in your custom page ini:
[Field 3]
Type=Text
Left=10
Right=-10
Top=20
Bottom=120
State=
Flags=MULTILINE|VSCROLL|READONLY
And then use this in you SetFunction for the custom page:
!insertmacro MUI_INSTALLOPTIONS_WRITE "LicensePage.ini" "Field 3" "State" "bla bla"
;and if you want to get fancy, put the next 2 lines in right
;before the !insertmacro MUI_INSTALLOPTIONS_SHOW line to
;make the background white again, even though your text box
;is readonly.
;Sets the white background on the readonly text box
GetDlgItem $R1 $R0 1202 ; 1200 + Field # - 1
SetCtlColors $R1 000000 FFFFFF
That is the code I use for a text box on a custom page, and the text is not selected, hope this helps.
smatte
13th October 2005 18:22 UTC
Thanks a lot! It work #1.
Just a last think. The print command show notepad even if I used SW_SHOWMINIMIZED (because SW_HIDE doesn't exist). I'll try to find an other method to print.
Jnuw
13th October 2005 18:30 UTC
Originally posted by smatte
The print command show notepad even if I used SW_SHOWMINIMIZED (because SW_HIDE doesn't exist). I'll try to find an other method to print.
Smatte, yes I have tried both SW_HIDE and SW_SHOWMINIMIZED, and both shows the notepad pop up for just a second or two. I have not been able to correct that, if you find an answer on that, please post back, or PM me. Thanks!
smatte
3rd November 2005 14:43 UTC
Here is the code you could use to print silently:
#extract license
>File /oname=$PLUGINSDIRLicense.txt "${LOCALPATH}\\License.txt"
>#print license
>StrCpy $0 "print" ;operation
StrCpy$1 "$PLUGINSDIR\\License.txt" ;path to license
StrCpy$2 "$PLUGINSDIR" ;directory
>#ShellExecute(
# HWND hwnd,
# LPCTSTR lpOperation, we want to print
# LPCTSTR lpFile,
# LPCTSTR lpParameters, no parameter for printing
# LPCTSTR lpDirectory,
# INT nShowCmd 0 = SW_HIDE
#);
>System::Call 'shell32::ShellExecute(v,t,t,t,t,i) v(,r0,r1,,r2,0)'
Jnuw
3rd November 2005 16:27 UTC
Thanks smatte! That's great, works perfectly.
Jnuw
sprinleo
31st August 2009 14:23 UTC
Hi Jnuw et al,
i am new NSIS.
i managed to create a custom page with all the controls that emulates the default license page.
do you know how to populate the text control to display the EULA ?
many thanks
Manohar
sprinleo
2nd September 2009 06:25 UTC
guys, please help, this thread is my only hope :(
i am trying to display the EULA in a custom page.
code:
-------------------------------------------------------
Function myLicensePageCreate
!insertmacro INSTALLOPTIONS_WRITE "myLicense.ini" "Field 2" "State" "$(license_txt)"
!include "winst\myLicense.nsh"
FunctionEnd
-----------------------------------------------------------
this simply does not show up anything in the EULA section. But if i enter a text in the place of "($license_txt)", it shows.
does anybody knows what am i missing, must be a small thingy.
any help will be much appreciated !