Archive: Two questions on MUI_PAGE_DIRECTORY


Two questions on MUI_PAGE_DIRECTORY
Could anybody help me to solve the following two problems?

1. I want two directory pages, how can I use different prompt texts for the two pages?
Now I can redefine ^DirText, ^DirSubText, ^DirBrowseText and change the language files of MUI to change the texts for one page. However, I don't know how to define two versions of all those texts.

2. I want two different installation languages, how can I solve the first problem for the two languages?
I noticed that MUI_LANGUAGE macro has to be loaded after all MUI_PAGE macros have been invoked. So, it seems impossible to define the texts before any MUI_PAGE_DIRECTORY command.


find an incomplete solution :-)
Following a previous discussion on how to disable controls in MUI_PAGE_DIRECTORY, now I can change most texts easily with the following codes:

!define MUI_PAGE_CUSTOMFUNCTION_SHOW ShowDirectoryPage
!insertmacro MUI_PAGE_DIRECTORY
Function ShowDirectoryPage
FindWindow $0 "#32770" "" $HWNDPARENT
GetDlgItem $1 $0 1020 ; IDC_SELDIRTEXT
StrCpy $2 "$(SelDirText)"
SendMessage $1 ${WM_SETTEXT} 0 "STR:$2"
GetDlgItem $1 $0 1006
StrCpy $2 "$(IntroText)"
SendMessage $1 ${WM_SETTEXT} 0 "STR:$2"
GetDlgItem $1 $HWNDPARENT 1037
StrCpy $2 "$(DirText)"
SendMessage $1 ${WM_SETTEXT} 0 "STR:$2"
GetDlgItem $1 $HWNDPARENT 1038
StrCpy $2 "$(DirSubText)"
SendMessage $1 ${WM_SETTEXT} 0 "STR:$2"
FunctionEnd

Now only two things are left:
1. How can I change "$(^DirBrowseText)" displayed in the directory-selection dialog after clicking "Brower" button?
2. The above code cannot change the texts of IDC_SPACEREQUIRED (1023) and IDC_SPACEAVAILABLE (1024). I don't know why.


The second problem has been hacked
Since my goal is to hide the two controls on space size, finally I found a way without emptying the texts.

GetDlgItem $1 $0 1023 ; IDC_SPACEREQUIRED
System::Call 'user32.dll::ShowWindow(i, i) v($1, 0)'
GetDlgItem $1 $0 1024 ; IDC_SPACEAVAILABLE
System::Call 'user32.dll::ShowWindow(i, i) v($1, 0)'

Now only one thing is left: How to change "$(^DirBrowseText)" displayed in the directory-selection dialog after clicking "Brower" button?

I noticed that the dialog is a child window of $HWNDPARENT, but the following code doesnot work at all:
FindWindow $0 "#32770" "ä¯ÀÀÎļþ¼Ð" $HWNDPARENT
It is very strange....


NSIS has a ShowWindow command.
SW_ defines are in !include WinMessages.nsh

Use DirText to change text:
http://nsis.sourceforge.net/Docs/Chapter4.html#4.8.1.14

You might have to modify the MUI code if you're using MUI though.

-Stu


Originally posted by Afrow UK
NSIS has a ShowWindow command.
SW_ defines are in !include WinMessages.nsh

Use DirText to change text:
http://nsis.sourceforge.net/Docs/Chapter4.html#4.8.1.14

You might have to modify the MUI code if you're using MUI though.

-Stu
Thanks. I just saw the ShowWindow command :-)

DirText cannot be used in a function, so we have not a chance to change the texts for the second MUI_PAGE_DIRECTORY. It can only change the texts of all directory pages. In fact, MUI also uses DirText to modify the two texts.

Do you have any idea on how to change ^DirBrowseText? MUI code does nothing on this. Do we have to rewrite the NSIS kernel code?

DirText can be used in PageEx. The MUI uses DirText in a PageEx block. That's why defining different text using the MUI defines above each separate page works. That's what you should use instead of SendMessage.

!define MUI_DIRECTORYPAGE_TEXT_TOP "1"
!insertmacro MUI_PAGE_DIRECTORY
!define MUI_DIRECTORYPAGE_TEXT_TOP "2"
!insertmacro MUI_PAGE_DIRECTORY
If the MUI doesn't provide a method to change ^DirBrowseText, change it with DirText and use a variable in its value and change the variable in the pre function of the page.

Originally posted by kichik
DirText can be used in PageEx. The MUI uses DirText in a PageEx block. That's why defining different text using the MUI defines above each separate page works. That's what you should use instead of SendMessage.
!define MUI_DIRECTORYPAGE_TEXT_TOP "1"
!insertmacro MUI_PAGE_DIRECTORY
!define MUI_DIRECTORYPAGE_TEXT_TOP "2"
!insertmacro MUI_PAGE_DIRECTORY
If the MUI doesn't provide a method to change ^DirBrowseText, change it with DirText and use a variable in its value and change the variable in the pre function of the page.
Yeah, I just noticed that DirText can change ^DirBrowseText by setting the 4th parameter. It seems that I am too lazy to read the help documents carefully ;-)

By adding a new definition in system.nsh, finally I easily set two different ^DirBrowseTexts. Now all my problems have been solved. As a suggestion to the author of SystemPlugIn, two more definitions should be added for changing browse_button_text and browse_dlg_text via DirText.

It is very happy to use NSIS to write installers under the help from you NSIS guys :-)

DirText cannot change the subtitle and DirIntroText of MUI_PAGE_DIRECTORY, so I have to continue to use SendMessage function to modify them.

Is there a normal way to do so without using SendMessage?