【问题标题】:Change default buttons name NSIS更改默认按钮名称 NSIS
【发布时间】:2013-08-22 06:39:22
【问题描述】:

我对 NSIS 很陌生, 我创建了一个带有 2 个屏幕的简单安装程序,

!include LogicLib.nsh
!include nsDialogs.nsh

Page custom someName someEndmethod
Page instfiles

第一个是自定义页面(nsDialogs),默认按钮是“安装”,我有 2 个问题:

  • 如何将方法绑定到其点击事件?
  • 如何更改该按钮上的文本?

顺便说一句 - 我没有使用 MUI。

我能找到的关于 nsDialogs 的最佳参考如下: http://nsis.sourceforge.net/Docs/nsDialogs/Readme.html

但似乎无法找到这些简单问题的答案。

谢谢

【问题讨论】:

  • nsDialogs 和其他自定义页面在内部对话框区域中,底部的按钮不是,也不是真正由用于创建自定义页面的插件控制。在主帮助文件中记录了有关在离开回调中调用 Abort 的部分...

标签: nsis


【解决方案1】:
!include WinMessages.nsh
Function MyPageCreate
GetDlgItem $0 $hwndparent 1 ; Get the handle to the button
SendMessage $0 ${WM_SETTEXT} 0 `STR:$(^NextBtn)` ; The part after STR: can be any string, using the next button language string here
nsDialogs::Create 1018
pop $0
nsDialogs::Show
FunctionEnd

Function MyPageLeave
MessageBox mb_yesno "User clicked Next/Install, allow the page change?" IDYES allow
    Abort
allow:
FunctionEnd

Page Components
Page Custom MyPageCreate MyPageLeave
Page InstFiles

如果您只想更改安装按钮上的字符串,无论它位于哪个页面(instfiles 页面之前的页面),您都可以使用LangString 来更改它。

【讨论】:

    猜你喜欢
    • 2012-07-06
    • 2017-06-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-07-24
    • 2018-12-27
    • 1970-01-01
    相关资源
    最近更新 更多