- NSIS Discussion
- replace CANCEL button text on just one page?
Archive: replace CANCEL button text on just one page?
ahdavidson
12th February 2007 21:48 UTC
replace CANCEL button text on just one page?
A how-to query from a brand-new NSIS user:
I would like to replace the text of a CANCEL button in the Modern UI for just one page.
I see how to accomplish this globally for all CANCEL buttons in the UI. I also see how to change the text of the ACCEPT/OK/AGREE button on a specific page.
What I have not been able to figure out is if there is an easy way to change the text of the CANCEL button on just the LICENSE page. (Our legal folks are very picky, and would like the UI to present the options as "Agree" or "Do Not Agree" instead of "Agree" or "Cancel.")
Can anyone suggest a solution?
Many thanks,
.andy
Red Wine
12th February 2007 22:03 UTC
OutFile "Test.exe"
InstallDir "$PROGRAMFILES\boo"
!include "mui.nsh"
!insertmacro MUI_PAGE_WELCOME
!define MUI_PAGE_CUSTOMFUNCTION_PRE dir_pre
!insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Docs\Modern UI\License.txt"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
Section "boo"
SectionEnd
Function dir_pre
GetDlgItem $0 $HWNDPARENT 2
SendMessage $0 ${WM_SETTEXT} "0" "STR:Do Not Agree"
FunctionEnd
ahdavidson
12th February 2007 22:18 UTC
Thanks for the answer! But being a newbie, I could use a little context for the code.
Where do I put this? fsp.nsi?
And what in that code restricts the replacement to just the Cancel button on the License page?
Thanks.
Red Wine
12th February 2007 22:47 UTC
Compile the example, execute it and you'll know where and what, all you need is this,
!define MUI_PAGE_CUSTOMFUNCTION_PRE dir_pre
just before your license page, and the function named dir_pre somewhere in your script.
mirolechat
13th February 2007 00:26 UTC
I'm working with andy on this project. Were both unfamiliar with the build process as we've been using the installer version built into Zinc. Within the zinc/nsis directory we've been editing the system.nsh with limited results to get btn changed.
Red Wine
13th February 2007 05:36 UTC
Don't know what is Zinc. If you're referring to NSIS\Contrib\Modern UI\System.nsh, you shouldn't touch it unless you know exactly what you're doing, you may destroy the Modern ui by doing this.
Anyway, what's the problem and you can't implement just 5 lines of (provided above) code in your script to achieve the text on cancel button specifically for license page?
If you don't know how to copy/paste text within a text editor, this isn't the right place to ask how to do it.
If you know, just copy/paste the line,
!define MUI_PAGE_CUSTOMFUNCTION_PRE dir_pre
just before the license page macro, and add the function,
Function dir_pre
GetDlgItem $0 $HWNDPARENT 2
SendMessage $0 ${WM_SETTEXT} "0" "STR:Do Not Agree"
FunctionEnd
on the bottom of your script.
That's all.
ahdavidson
13th February 2007 07:06 UTC
Thanks very much for the code, and also your kind, patient, and polite attitude towards novices.
Red Wine
13th February 2007 07:31 UTC
You're welcome!
I'm just trying within my limited nsis knowledge to help everyone including those with sarcastic attitude.
M1qu3l
26th February 2007 16:32 UTC
got a new question related!
Hi everybody!
What I was wondering is how it would be if instead of trying to change cancel button text from licence page we try to change cancel button text on language dialog selection.
I cannot figure out because in this case we have not any page defined...
I found couple of tags like MUI_LANGDLL_WINDOWTITLE and MUI_LANGDLL_INFO, but still do not knok to to change buttons text on this dialog....
I'd be really gratefull if someone answer me, but thanks anyway to everybody!
jackkoho
22nd May 2007 20:25 UTC
Originally posted by Red Wine
Don't know what is Zinc. If you're referring to NSIS\Contrib\Modern UI\System.nsh, you shouldn't touch it unless you know exactly what you're doing, you may destroy the Modern ui by doing this.
Anyway, what's the problem and you can't implement just 5 lines of (provided above) code in your script to achieve the text on cancel button specifically for license page?
If you don't know how to copy/paste text within a text editor, this isn't the right place to ask how to do it.
If you know, just copy/paste the line,
!define MUI_PAGE_CUSTOMFUNCTION_PRE dir_pre
just before the license page macro, and add the function,
Function dir_pre
GetDlgItem $0 $HWNDPARENT 2
SendMessage $0 ${WM_SETTEXT} "0" "STR:Do Not Agree"
FunctionEnd
on the bottom of your script.
That's all.
Should this work for an INSTFILES page? Ive tried the exact code and can't get it to work. Trying to change "Close" to "Next>"
jackkoho
24th May 2007 18:37 UTC
bump
Afrow UK
25th May 2007 17:00 UTC
It should work. If not, put it in a dummy (hidden) Section.
Stu
jackkoho
25th May 2007 19:45 UTC
I realized that it did change cancel to next while it was installing, but then changed back to cancel when it was done.
Another thing: I want to change the "close" button, not the cancel button, so is there a paramater I need to change to make this work?
Afrow UK
26th May 2007 14:15 UTC
Just put an empty Page after it.
!insertmacro MUI_PAGE_INSTFILES
Page Custom PageDummy
Function PageDummy
FunctionEnd
No need to change the button text then.
Stu
jackkoho
30th May 2007 18:34 UTC
Thanks.