How can I modify the text in the MUI_WELCOME_PAGE when using MUI2 for NSIS?
Asked Answered
H

2

14

I want to add a label displaying the full version-string in the welcome screen in the installer I am creating using NSIS with MUI2.

I have searched for info on how to do this, but only found references to using MUI_INSTALLOPTIONS* which I found ws deprecated for MUI2. Another one referred to the newer versions using INSTALLOPTIONS* with the same options, but I could not get it working. I finally also found a reference to using nsDialogs for this - which is what I am using for my custom pages. However - I found no reference or samples on how to change any of the existing pages that comes with MUI2.nsh.

I found a way to change the MUI_HEADERTEXT, but that doesn't affect the welcome-screen. I wish there was a way to also change the welcometext. Maybe using MUI_WELCOMETITLE and MUI_WELCOMEBODY or similar.

Hernardo answered 15/3, 2011 at 22:44 Comment(0)
H
15

There is MUI_WELCOMEPAGE_TEXT but it is only useful if you want to change all of the text and not just append something.

During the show function for the page, you can change the text of any control:

outfile test.exe
requestexecutionlevel user

!include MUI2.nsh

#!define MUI_WELCOMEPAGE_TEXT "New text goes here"
!define MUI_PAGE_CUSTOMFUNCTION_SHOW MyWelcomeShowCallback
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"


Function MyWelcomeShowCallback
SendMessage $mui.WelcomePage.Text ${WM_SETTEXT} 0 "STR:$(MUI_TEXT_WELCOME_INFO_TEXT)$\n$\nVersion: foo.bar"
FunctionEnd

Section
SectionEnd

..or add a new control:

outfile test.exe
requestexecutionlevel user

!include MUI2.nsh

!define MUI_PAGE_CUSTOMFUNCTION_SHOW MyWelcomeShowCallback
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"


Function MyWelcomeShowCallback
${NSD_CreateLabel} 120u 150u 50% 12u "Version: foo.bar"
Pop $0
SetCtlColors $0 "" "${MUI_BGCOLOR}"
FunctionEnd

Section
SectionEnd
Hydrogenize answered 15/3, 2011 at 23:21 Comment(5)
I used the second suggestion and haven't tried the first one. Worked like a charm, thanks :)Hernardo
Both methods suggested here worked for me (NSIS3, MUI2)Request
found out that SendMessage requires STR: to be prepended to the string the hard way: nsis.sourceforge.net/Reference/SendMessageYangyangtze
hm, I finally failed to use $mui.WelcomePage.Text in the uninstaller - I only succeeded to set the dialog headline in the menubar using $HWNDPARENTYangyangtze
Second solution worked like a charm to me, thanks!Dissyllable
P
0

I also had the issue with NSIS. In my case it worked to define MUI_WELCOMEPAGE_TITLE before inserting the macro MUI_PAGE_WELCOME.

It should look like:

!define MUI_WELCOMEPAGE_TITLE  "CUSTOM TITLE HERE"
!insertmacro MUI_PAGE_WELCOME
Peripatetic answered 3/6, 2021 at 12:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.