- NSIS Discussion
- Change words on MUI *Browse for Folder* window
Archive: Change words on MUI *Browse for Folder* window
bubustoober
22nd May 2009 07:25 UTC
Change words on MUI *Browse for Folder* window
New to NSIS... using MUI. On an MUI_PAGE_DIRECTORY when the user clicks the "Browse" button, the "Browse for Folder" window appears. There are words across the top "Select the folder to install <Name> in:" I am using MUI_PAGE_DIRECTORY several times within one project to collect several different paths from the user.
I would like to change the wording at the top of the "Browse for Folder" window. Ideas?
Thanks in advance!
bubustoober
26th May 2009 19:16 UTC
Bump
Animaether
26th May 2009 20:48 UTC
I'm not sure you can.. but you can always write your own directory page, and use SelectFolderDialog()...
nsDialogs::SelectFolderDialog <text to display above folder tree> [initial location]
Afrow UK
26th May 2009 21:44 UTC
Actually, the browse button and browse dialog texts can be set with DirText. MUI2 uses DirText internally (Modern UI 2\Pages\Directory.nsh:47) but only supplies the first two parameters (set with MUI_DIRECTORYPAGE_TEXT_TOP and MUI_DIRECTORYPAGE_TEXT_DESTINATION).
DirText [text] [subtext] [browse_button_text] [browse_dlg_text]
You can modify that file to add two defines for the additional DirText parameters and submit as a patch (or just submit as a feature request for the next NSIS version).
Careful to !insertmacro MUI_DEFAULT for your two new defines as shown on lines 38 and 29 so that they are given empty values by default (when they have not been defined). This ensures that the default texts are used.
Stu
Animaether
26th May 2009 21:59 UTC
ahhh... vote for adding this information to the MUI documentation ;)
bubustoober
28th May 2009 06:10 UTC
Thanks for the help guys!
What I ended up doing was modifying the MUI's System.nsh on line 884 to say a more generic "Please select a folder:" on all my "Browse for Folder" windows.
System.nsh:884 before:
;DirText "${MUI_DIRECTORYPAGE_TEXT_TOP}" "${MUI_DIRECTORYPAGE_TEXT_DESTINATION}"
System.nsh:884 after:
DirText "${MUI_DIRECTORYPAGE_TEXT_TOP}" "${MUI_DIRECTORYPAGE_TEXT_DESTINATION}" "" "Please select a folder:"
acristin
28th May 2009 20:58 UTC
I have a related question that probably doesn't warrant it's own thread (but I'd be happy to post one if any of you think I should).
How can I change the text above the directory location text box? Our client wants the installer to have a warning not to install to a mapped network drive.
bubustoober
28th May 2009 21:33 UTC
From the Modern UI readme:
(http://nsis.sourceforge.net/Docs/Mod...UI/Readme.html)
MUI_DIRECTORYPAGE_TEXT_TOP text
Text to display on top of the page.
~or~
MUI_DIRECTORYPAGE_TEXT_DESTINATION text
Text to display on the destination folder frame.
If you're not using MUI, use one of the first two parameters for DirText.
(see NSIS installer attributes http://www.nullsoft.com/free/nsis/makensis.htm)
DirText [text] [subtext] [browse_button_text] [browse_dlg_text]
acristin
28th May 2009 21:42 UTC
I guess my problem is that I don't know where (or how, really) to set that variable. strcpy seems to be the way to assign a variable a constant value (which is what the message would be), but it needs to be inside of a function, and I don't know which function it can be placed in.
bubustoober
28th May 2009 21:49 UTC
Are you using the Modern UI?
acristin
28th May 2009 21:56 UTC
Yes.
Edit: Thanks for the help, I didn't realize I could just define that variable before inserting the page macro.
bubustoober
28th May 2009 22:10 UTC
Use the attached script as an example, see lines 33 through 39 as examples for setting MUI_PAGE_DIRECTORY variables.