Hi,
I wonder if it is possible to have a nsDialogs::SelectFolderDialog without the 'create new folder' button? Or at least to disbale this button?
I use this on a custom page where the user should be able to select as many existing folders as desired. Therefor creating a new folder is not wanted/ makes no sense in this case.
If it could be done by the FindWindow and GetDlgItem method - does anybody know the correct parameters?
Thanks,
Gunther
SelectFolderDialog without 'Create new folder'?
4 posts
'fraid there's no such luck - once the dialog opens, code execution is locked.
You can always create the folder browse dialog yourself, of course:
You can always create the folder browse dialog yourself, of course:
!include "nsDialogs.nsh"
!include "LogicLib.nsh"
OutFile "$%temp%\temp.exe"
; See also: http://msdn.microsoft.com/en-us/library/bb762115%28VS.85%29.aspx
!define BIF_RETURNONLYFSDIRS 0x00000001
Section
; Buffer to hold a display name output, not actively used.
System::Call '*(&t260) i.r0'
; Struct to handle the select folder dialog. You'd probably only care about the text at the top.
System::Call "*(i$HWNDPARENT, i, ir0, t'Text at top', i${BIF_RETURNONLYFSDIRS}, i, i, i) i.r1"
; The actual call
System::Call "shell32::SHBrowseForFolder(i r1) i.r2"
; Some logic checking on its output
${If} $2 == 0
MessageBox MB_OK "User canceled browsing."
${Else}
; Get the actual path from the pidl
System::Call "shell32::SHGetPathFromIDList(i r2, t.r3)"
; and display
MessageBox MB_OK "User selected folder: $3"
${EndIf}
; Clean up the structs
System::Free $0
System::Free $1
SectionEnd
Animaether,
But really - I'd prefer if this would be available by nsDialogs (maybe differenced by a parameter).
BTW: It is not necessary to include LogicLib when using nsDialogs as it already includes
LogicLib as well as WinMessages.
</smartypants>
Thanks for code example, but I have already added hundred of lines of code to my script just to make same small changes to the standard behaviour of NSIS 😔 - so in this case I leave it to the user ...!
Thanks again for your really helpful answer,
Gunther
Of course ...! 😛Originally Posted by Animaether View Post'fraid there's no such luck - once the dialog opens, code execution is locked.
You can always create the folder browse dialog yourself, of course:
But really - I'd prefer if this would be available by nsDialogs (maybe differenced by a parameter).
<smartypants>
!include "nsDialogs.nsh"
!include "LogicLib.nsh"
BTW: It is not necessary to include LogicLib when using nsDialogs as it already includes
LogicLib as well as WinMessages.
</smartypants>
Thanks for code example, but I have already added hundred of lines of code to my script just to make same small changes to the standard behaviour of NSIS 😔 - so in this case I leave it to the user ...!
Thanks again for your really helpful answer,
Gunther
Sure - but that'll need a change to the plugin itself; you'd have to officially log it as a wish list item 🙂Originally Posted by Netsurfer24 View PostBut really - I'd prefer if this would be available by nsDialogs (maybe differenced by a parameter).
True - but whenever I use functionality from a library explicitly, I like including that library myself (near-ish the top of the file) so that anybody reviewing the code can see the dependency. Say somebody else takes over my project and ditches nsDialogs for InstallOpensEx for whatever reason. They remove the "!include nsDialogs.nsh" and *boink* goes the compiled as soon as it hits the ${If}-etc. bits 🙂Originally Posted by Netsurfer24 View PostBTW: It is not necessary to include LogicLib when using nsDialogs as it already includes
LogicLib as well as WinMessages.
Well, then what's 10 more? 😉Originally Posted by Netsurfer24 View PostThanks for code example, but I have already added hundred of lines of code to my script just to make same small changes to the standard behaviour of NSIS
No problem - if nothing else, others who might have been wondering about this will be helped as well.. yay forums 🙂Originally Posted by Netsurfer24 View PostThanks again for your really helpful answer
(presuming they search :x)