Archive: Load existing Language Strings into custom page.


Load existing Language Strings into custom page.
Hello all..

I am trying to create a custom page and load already existing language strings into it. For example "MUI_TEXT_WELCOME_INFO_TITLE".

I am using the following code, but it doesn't seem to work.

;--------------------------------
;Include all libs

!include "MUI.nsh" ; --- MUI 1.66 compatible
!include "LogicLib.nsh" ; --- Include logic statement capabilities
!include "nsDialogs.nsh" ; --- Include custom pages capabilities

;--------------------------------
;General Information

Name
BrandingText
OutFile
InstallDir

Var Dialog
Var Label
Var mui.WelcomePage.Title
Var mui.WelcomePage.Title.Font
Var mui.WelcomePage.Text

;--------------------------------
;Define images and include pages

!define MUI_ABORTWARNING
Page custom nsDialogsPage
!insertmacro MUI_PAGE_INSTFILES

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

!insertmacro MUI_LANGUAGE "English" ;first language is the default language

!insertmacro MUI_DEFAULT MUI_WELCOMEPAGE_TITLE "$(MUI_TEXT_WELCOME_INFO_TITLE)"
!insertmacro MUI_DEFAULT MUI_WELCOMEPAGE_TEXT "$(MUI_TEXT_WELCOME_INFO_TEXT)"

!insertmacro MUI_UNSET MUI_WELCOMEPAGE_TITLE
!insertmacro MUI_UNSET MUI_WELCOMEPAGE_TITLE_3LINES
!insertmacro MUI_UNSET MUI_WELCOMEPAGE_TEXT

;--------------------------------
;Custom Page - Welcome
Function nsDialogsPage

nsDialogs::Create 1018
Pop $Dialog

${NSD_CreateLabel} 0 0 100% 12u "Hello, welcome to nsDialogs!"
Pop $Label

;Positiong of controls
;Title
!ifndef MUI_WELCOMEPAGE_TITLE_3LINES
!define MUI_WELCOMEPAGE_TITLE_HEIGHT 28
!else
!define MUI_WELCOMEPAGE_TITLE_HEIGHT 38
!endif

;Text
;17 = 10 (top margin) + 7 (distance between texts)
!define /math MUI_WELCOMEPAGE_TEXT_TOP 17 + ${MUI_WELCOMEPAGE_TITLE_HEIGHT}

;Title
${NSD_CreateLabel} 120u 10u 195u ${MUI_WELCOMEPAGE_TITLE_HEIGHT}u "$(MUI_WELCOMEPAGE_TITLE)"
Pop $mui.WelcomePage.Title
CreateFont $mui.WelcomePage.Title.Font "$(^Font)" "12" "700"
SendMessage $mui.WelcomePage.Title ${WM_SETFONT} $mui.WelcomePage.Title.Font 0

;Welcome text
${NSD_CreateLabel} 120u ${MUI_WELCOMEPAGE_TEXT_TOP}u 195u 130u "${MUI_WELCOMEPAGE_TEXT}"
Pop $mui.WelcomePage.Text

!insertmacro MUI_UNSET MUI_WELCOMEPAGE_TITLE_HEIGHT
!insertmacro MUI_UNSET MUI_WELCOMEPAGE_TEXT_TOP

nsDialogs::Show

FunctionEnd


Section
SectionEnd


This only displays: "$(MUI_WELCOMEPAGE_TITLE)" and "${MUI_WELCOMEPAGE_TEXT}".
If I replace "${MUI_WELCOMEPAGE_TEXT}" with (as according to the manual) $(^MUI_TEXT_WELCOME_INFO_TEXT) it stays blank.

Am I missing something?

All I am trying to do is recreate the Welcome page but include a piece of text. Because as far as I can't include a custom text string into the welcome page?
MUI_TEXT_WELCOME_INFO_TITLE
*Some Custom Text*
MUI_TEXT_WELCOME_INFO_TEXT

Thanks in advanced,
Ruud

A different forum recommended to do the following, they said this should add a box to the welcome page. However it does not display anything


!define MUI_PAGE_CUSTOMFUNCTION_SHOW MyWelcomeShow
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_INSTFILES

;--------------------------------
;Custom Page - Welcome

Function MyWelcomeShow
${NSD_CreateLabel} 100u 100u 50% 100u "TEXT"
Pop $0
FunctionEnd

Section
SectionEnd


And the following created a new custom page (not adding to it).

!define MUI_PAGE_CUSTOMFUNCTION_SHOW MyWelcomeShow
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_INSTFILES

;--------------------------------
;Custom Page - Welcome

Function MyWelcomeShow
nsDialogs::Create 1044
Pop $Dialog

${NSD_CreateLabel} 100u 100u 50% 100u "TEXT"
Pop $0

nsDialogs::Show
FunctionEnd

Section
SectionEnd



Both results are as expected and as described in the manual..
But maybe they have misquoted something? And there is a possibility to add text into the welcome page? (without editing the language files)

Thanks,

You have two mistakes:
1. You need to use MUI2.nsh if you are using nsDialogs (MUI.nsh uses old InstallOptions for its Welcome/Finish pages).
2. You don't need to do nsDialogs::Create/nsDialogs::Show; MUI2 already does that.

Stu


Thank you!
Can't believe I missed that.

Thanks,
Ruud