Archive: CustomLicense with MUI?


CustomLicense with MUI?
i have a problem adapting the CustomLicense example for a MUI installer. has anybody used it? please upload script!

i'm using

  Function PreLicense
ReadINIStr $LicenseType "$PLUGINSDIR\pimp.ini" "Installer" "LicenseType"
IfFileExists "$PLUGINSDIR\license.$LicenseType" +2
Abort
FunctionEnd

Function SwitchLicense
FindWindow $0 "#32770" "" $HWNDPARENT
GetDlgItem $0 $0 1000
CustomLicense::LoadFile "$PLUGINSDIR\license.$LicenseType" $0
FunctionEnd


pages look like this:
  ;Modern UI Configuration
!define MUI_CUSTOMPAGECOMMANDS
#!ifdef LICENSE
!define MUI_PAGE_CUSTOMFUNCTION_PRE PreLicense
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE SwitchLicense
!define MUI_LICENSEPAGE
!define MUI_LICENSEPAGE_BGCOLOR "FFFFFF"
#!endif
!define MUI_DIRECTORYPAGE
!define MUI_COMPONENTSPAGE
!define MUI_ABORTWARNING

Re: CustomLicense with MUI?
Hi there!

There is a nice example on the wiki page.

http://nsis.sourceforge.net/CustomLicense_plug-in

And... I think you should set the license in the pre function call as well. The leave function is too late!

If you can't solve your problem, describe the problem exactly.

Cheers!

Bruno


the installer worked perfectly before switching to MUI, here's the code i've used

pages:

;Pages
Page License PreLicense SwitchLicense
Page Directory
Page Components
Page InstFiles


functions:
  Function PreLicense
ReadINIStr $LicenseType "$PLUGINSDIR\pimp.ini" "Installer" "LicenseType"
IfFileExists "$PLUGINSDIR\license.$LicenseType" +2
Abort
FunctionEnd

Function SwitchLicense
FindWindow $0 "#32770" "" $HWNDPARENT
GetDlgItem $0 $0 1000
CustomLicense::LoadFile "$PLUGINSDIR\license.$LicenseType" $0
FunctionEnd


i don't see what i'm doing wrong handling the custom pages the same way. for my understanding, my code should do.

You've set SwitchLicense as the leave function of the page instead of its show function.


i've tried that, kichik - didn't work. i have another assumption that my mistake lies in the following:

;Pages
##Page custom PreLicense
#Page License PreLicense SwitchLicense
#Page Directory
#Page Components
#Page InstFiles


!define MUI_PAGE_CUSTOMFUNCTION_SHOW "SwitchLicense" #SwitchLicense
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE "PreLicense"
!insertmacro MUI_PAGE_LICENSE "dummy.txt"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_INSTFILES

preceded by this code
  ;Modern UI Configuration
##SKIN##!define MUI_CUSTOMFUNCTION_GUIINIT myGuiInit
##SKIN##!define MUI_PAGE_CUSTOMFUNCTION_SHOW CompColor
!define MUI_CUSTOMPAGECOMMANDS
#!ifdef LICENSE
# !define MUI_PAGE_CUSTOMFUNCTION_PRE "PreLicense"
# !define MUI_PAGE_CUSTOMFUNCTION_LEAVE "SwitchLicense"
# !define MUI_LICENSEPAGE
!define MUI_LICENSEPAGE_BGCOLOR "FFFFFF"
#!endif
!define MUI_DIRECTORYPAGE
!define MUI_COMPONENTSPAGE
!define MUI_ABORTWARNING

!define MUI_ICON "icons\pimpbot_runtime.ico"
!define MUI_COMPONENTSPAGE_CHECKBITMAP "ui\yi-nusimple.bmp"
!define MUI_INSTFILESPAGE_COLORS "000000 FFFFFF"
!define MUI_INSTFILESPAGE_PROGRESSBAR "colored smooth"


am i putting the code in the wrong part of my source?

Try this:


!define MUI_PAGE_CUSTOMFUNCTION_PRE "PreLicense"
!define MUI_PAGE_CUSTOMFUNCTION_SHOW "SwitchLicense"
!insertmacro MUI_PAGE_LICENSE "dummy.txt"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_INSTFILES

great, it works. thank you!