ilaiyaraja
28th August 2013 12:49 UTC
How to create user defined directory page?
!insertmacro MUI_PAGE_DIRECTORY
In the code can be used to display the built-in directory page.
Is possible to create user defined page directory? because i need to call many times this page.
How to create user defined page directory?
MSG
28th August 2013 13:12 UTC
You can probably just use multiple built-in directory pages. Simply insert the macro multiple times. You can customize each page using these defines:
MUI_DIRECTORYPAGE_TEXT_TOP text
MUI_DIRECTORYPAGE_TEXT_DESTINATION
MUI_DIRECTORYPAGE_VARIABLE
See the MUI2 readme: http://nsis.sourceforge.net/Docs/Mod...02/Readme.html
ilaiyaraja
29th August 2013 06:30 UTC
Thanks MSG.
I have tried following way to create directory page manually.
!define MUI_PAGE_CUSTOMFUNCTION_PRE MyDir
!define MUI_PAGE_CUSTOMFUNCTION_SHOW ShowDirectory
!insertmacro MUI_PAGE_DIRECTORY
Function MyDir
${DriveSpace} "C:\" "/D=F /S=G" $R0
${If} $R0 <= 2
MessageBox MB_OK "Going to display"
call ShowDirectoryPage
${EndIf}
Function ShowDirectory
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"
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)'
FunctionEnd
but in the ShowDirectory function didnot display directory page.Also i got warning messages for this function.
MSG
29th August 2013 08:54 UTC
You're missing a FunctionEnd after MyDir
ilaiyaraja
29th August 2013 09:35 UTC
oh sorry.Its my mistake i didnot copy the code properly.
define MUI_PAGE_CUSTOMFUNCTION_PRE MyDir
!define MUI_PAGE_CUSTOMFUNCTION_SHOW ShowDirectory
!insertmacro MUI_PAGE_DIRECTORY
Function MyDir
${DriveSpace} "C:\" "/D=F /S=G" $R0
${If} $R0 <= 2
MessageBox MB_OK "Going to display"
call ShowDirectoryPage
${EndIf}
FunctionEnd
Function ShowDirectory
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"
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)'
FunctionEnd
Following warnings displayed
LangString "SelDirText" is not set in language table of language English
LangString "IntroText" is not set in language table of language English
LangString "DirText" is not set in language table of language English
LangString "DirSubText" is not set in language table of language English
MSG
1st September 2013 08:09 UTC
You need to !insertmacro MUI_LANGUAGE "English" after all (un)page macros are inserted.
ilaiyaraja
2nd September 2013 07:03 UTC
I have already included this macro after all page macros are inserted.
!insertmacro MUI_LANGUAGE English
Is there need to insert before this page ShowDirectory load?
T.Slappy
2nd September 2013 08:44 UTC
Maybe it is easier to create custom directory page (few labels, edit box and button with nsDialogs::SelectFolder function) with nsDialogs?
It can be shown many times with appropriate parameters without using a lot of code.