Archive: SelectFolderDialog without 'Create new folder'?


SelectFolderDialog without 'Create new folder'?
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


'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:


!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,

Originally posted by Animaether
'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:
Of course ...! :p
But really - I'd prefer if this would be available by nsDialogs (maybe differenced by a parameter).

!include "nsDialogs.nsh"
!include "LogicLib.nsh"
<smartypants>
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 :hang: - so in this case I leave it to the user ...!

Thanks again for your really helpful answer,

Gunther

Originally posted by Netsurfer24
But really - I'd prefer if this would be available by nsDialogs (maybe differenced by a parameter).
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
BTW: It is not necessary to include LogicLib when using nsDialogs as it already includes
LogicLib as well as WinMessages.
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
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
Well, then what's 10 more? ;)

Originally posted by Netsurfer24
Thanks again for your really helpful answer
No problem - if nothing else, others who might have been wondering about this will be helped as well.. yay forums :)
(presuming they search :x)