简体   繁体   English

将 MUI2 用于 NSIS 时,如何修改 MUI_WELCOME_PAGE 中的文本?

[英]How can I modify the text in the MUI_WELCOME_PAGE when using MUI2 for NSIS?

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.我想在我使用 NSIS 和 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.我搜索了有关如何执行此操作的信息,但只找到了使用 MUI_INSTALLOPTIONS* 的参考,我发现 ws 已弃用 MUI2。 Another one referred to the newer versions using INSTALLOPTIONS* with the same options, but I could not get it working.另一个提到使用具有相同选项的 INSTALLOPTIONS* 的较新版本,但我无法让它工作。 I finally also found a reference to using nsDialogs for this - which is what I am using for my custom pages.我终于还找到了一个使用 nsDialogs 的参考 - 这就是我用于自定义页面的内容。 However - I found no reference or samples on how to change any of the existing pages that comes with MUI2.nsh.但是 - 我没有找到关于如何更改 MUI2.nsh 附带的任何现有页面的参考或示例。

I found a way to change the MUI_HEADERTEXT, but that doesn't affect the welcome-screen.我找到了一种更改 MUI_HEADERTEXT 的方法,但这不会影响欢迎屏幕。 I wish there was a way to also change the welcometext.我希望有一种方法也可以更改欢迎文本。 Maybe using MUI_WELCOMETITLE and MUI_WELCOMEBODY or similar.也许使用 MUI_WELCOMETITLE 和 MUI_WELCOMEBODY 或类似的。

There is MUI_WELCOMEPAGE_TEXT but it is only useful if you want to change all of the text and not just append something.有 MUI_WELCOMEPAGE_TEXT 但它仅在您想更改所有文本而不只是附加某些内容时才有用。

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

I also had the issue with NSIS.我也遇到了 NSIS 的问题。 In my case it worked to define MUI_WELCOMEPAGE_TITLE before inserting the macro MUI_PAGE_WELCOME.在我的例子中,它在插入宏 MUI_PAGE_WELCOME 之前定义了 MUI_WELCOMEPAGE_TITLE。

It should look like:它应该看起来像:

!define MUI_WELCOMEPAGE_TITLE  "CUSTOM TITLE HERE"
!insertmacro MUI_PAGE_WELCOME

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 更改 NSIS MUI2 页面上窗口的 z-index - Alter the z-index of windows on a NSIS MUI2 Page nsis 安装程序 autoexits/ 自动关闭,我正在使用 pre 和 show 函数来显示目录 MUI 页面 - nsis installer autoexits/ closes automatically , i am using pre and show functions to show a directory MUI page NSIS 安装程序 MUI_HEADER_TEXT - 这一部分可以是粗体吗? - NSIS Installer MUI_HEADER_TEXT - Can part of this be bold font? 在 NSIS 对话框页面中添加自定义标签,有条件地在 NSIS MUI 目录页面中显示和隐藏标签,如何获取标签的 id - Adding custom labels in NSIS dialog pages, showing and hiding labels in NSIS MUI Directory pages conditionally, how to get the ids of labels 按钮插件在 MUI NSIS 安装程序中不能用于多个按钮 - button plugin not working for more than one button in MUI NSIS Installer 在 nsis 中使用 2 个欢迎/完成页面图像 - Use 2 welcome/finish page images in nsis 我如何调用一个使用NSIS系统插件导入另一个dll的dll - How can i call a dll that import another dll using NSIS system plugin 如何使用nsis在我的设置中添加背景? - How can I put a background in my setup with nsis? 在 MUI NSI 安装程序中单击按钮时填充目录文本框,使用 ButtonEvent 插件 - fill directory textbox on button click in MUI NSI Installer , using ButtonEvent plug-in 如何使用nsis保护文件免受删除? - How to protect file from deletion using nsis?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM