Archive: Print button on the license dialog page


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:


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!

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.


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.

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.


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!

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

Thanks smatte! That's great, works perfectly.

Jnuw


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


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 !