Rivka
15th July 2008 14:32 UTC
Disable the browse button in a "dirrequest" field
Hi all,
In one of the custom pages in the installer I'm writing, I need the possibility to disable the browse button of a dirrequest control (the text field stays enabled).
Searching in NSIS examples, I've seen they do something like that in at their filefunc example, (there are more examples, but the difficuly I face is common to them) I see they refer explicit control id.
My question is "How do I know which id belong to what control" and as I've mentioned, there might be at least 2 control connected to "dirrequest" - the browse button and the text field, and I wish to disable the browse button only.
Please advice,
:(
Thanks,
Rivka
Comperio
15th July 2008 16:10 UTC
If you are using InstallOptions, then you just read HWND2 from your page's INI file. For example, if your control is Field 3, then to get the HWND of the button, you would do something like this:
ReadIniStr $1 "$PLUGINSDIR\page.ini" "Field 3" "HWND2" ; $1 would now contain the HWND of the button
If you are using nsDialogs for the page, then you'll have the text box and button as separate items, which means, you can just target the button directly. (For an example of using a browse button with nsDialogs, see
this post)
Once you obtain the button's HWND, then you just need use the
EnableWindow command. For example, if $1 is the HWND of your button, then the command would be:
EnableWindow $1 0 ; 0 disables the control, 1 will enable it.