Old 30th June 2008, 18:52   #1
green2000
Junior Member
 
Join Date: Jun 2008
Posts: 3
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?
green2000 is offline   Reply With Quote
Old 30th June 2008, 19:07   #2
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
Weird... this works as it's supposed to do:
EDIT: InstallButtonText should be replaced with MiscButtonText and must be initialized in function .onInit
code:
;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


Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 30th June 2008, 19:52   #3
green2000
Junior Member
 
Join Date: Jun 2008
Posts: 3
Great Thanks Red Wine
green2000 is offline   Reply With Quote
Old 6th July 2008, 13:07   #4
green2000
Junior Member
 
Join Date: Jun 2008
Posts: 3
Hmmm....
I use UltraModernUI - how to improve my code for this UI? It's still beta, but my Boss doesn't like MUI :/
green2000 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