Archive: MUI_PAGE_WELCOME - how to change labels?


MUI_PAGE_WELCOME - how to change labels?
Hello!

How to change labels for text/title etc on welcome page?
My installer has two states: installer or actualizer. For each i must change labels for:
MUI_WELCOMEPAGE_TITLE
MUI_WELCOMEPAGE_TEXT
InstallButtonText

But when i use this code i got empty strings:

Var install_button_text
Var welcome_title
Var welcome_text
...
!define MUI_PAGE_CUSTOMFUNCTION_PRE WelcomePagePre
!define MUI_WELCOMEPAGE_TITLE '$welcome_title'
!define MUI_WELCOMEPAGE_TEXT '$welcome_text'
InstallButtonText $install_button_text
!insertmacro MUI_PAGE_WELCOME

...
Function WelcomePagePre
strcpy $install_mode '0' ; test value
${if} $install_mode == '0'
strcpy $install_button_text "Actualize"
strcpy $welcome_title "Welcome title for actualization"
strcpy $welcome_text "Welcome text for actualization"
${else}
strcpy $install_button_text "Install"
strcpy $welcome_title "Welcome title for installation"
strcpy $welcome_text "Welcome text for installation"
${endif}
MessageBox MB_OK "$welcome_title$\n$welcome_text"
FunctionEnd

How to change these labels?


Weird... this works as it's supposed to do:
EDIT: InstallButtonText should be replaced with MiscButtonText and must be initialized in function .onInit

;NSIS Modern User Interface
;Basic Example Script
;Written by Joost Verburg

;--------------------------------
;Include Modern UI

!include "MUI2.nsh"
!include "logiclib.nsh"

Var install_button_text
Var welcome_title
Var welcome_text
var install_mode

;--------------------------------
;General

;Name and file
Name "Modern UI Test"
OutFile "Basic.exe"

;Default installation folder
InstallDir "$LOCALAPPDATA\Modern UI Test"

;Get installation folder from registry if available
InstallDirRegKey HKCU "Software\Modern UI Test" ""

;Request application privileges for Windows Vista
RequestExecutionLevel user
InstallButtonText $install_button_text
;--------------------------------
;Interface Settings

!define MUI_ABORTWARNING

;--------------------------------
;Pages

!define MUI_PAGE_CUSTOMFUNCTION_PRE WelcomePagePre
!define MUI_WELCOMEPAGE_TITLE '$welcome_title'
!define MUI_WELCOMEPAGE_TEXT '$welcome_text'
!insertmacro MUI_PAGE_WELCOME

!insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Docs\Modern UI\License.txt"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES

!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES

;--------------------------------
;Languages

!insertmacro MUI_LANGUAGE "English"

;--------------------------------
;Installer Sections

Section "Dummy Section" SecDummy

SetOutPath "$INSTDIR"

;ADD YOUR OWN FILES HERE...

;Store installation folder
WriteRegStr HKCU "Software\Modern UI Test" "" $INSTDIR

;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"

SectionEnd

;--------------------------------
;Descriptions

;Language strings
LangString DESC_SecDummy ${LANG_ENGLISH} "A test section."

;Assign language strings to sections
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SecDummy} $(DESC_SecDummy)
!insertmacro MUI_FUNCTION_DESCRIPTION_END

;--------------------------------
;Uninstaller Section

Section "Uninstall"

;ADD YOUR OWN FILES HERE...

Delete "$INSTDIR\Uninstall.exe"

RMDir "$INSTDIR"

DeleteRegKey /ifempty HKCU "Software\Modern UI Test"

SectionEnd


Function WelcomePagePre
strcpy $install_mode '0' ; test value
${if} $install_mode == '0'
strcpy $install_button_text "Actualize"
strcpy $welcome_title "Welcome title for actualization"
strcpy $welcome_text "Welcome text for actualization"
${else}
strcpy $install_button_text "Install"
strcpy $welcome_title "Welcome title for installation"
strcpy $welcome_text "Welcome text for installation"
${endif}
MessageBox MB_OK "$welcome_title$\n$welcome_text"
FunctionEnd

Great :) Thanks Red Wine :)


Hmmm....
I use UltraModernUI - how to improve my code for this UI? It's still beta, but my Boss doesn't like MUI :/