Skip to content
⌘ NSIS Forum Archive

Mui Button Focus

8 posts

jaschulz#

Mui Button Focus

I would like to draw the focus to the cancel button when the user arrives at the License Page. Is there any way to do this?

Thanks,

JAS
rsegal#
Should be able to do it getting the window handle of the cancel button and then send a WM_SETFOCUS message using SendMessage.

Something like,
SendMessage $R0 WM_SETFOCUS 0 0 
where $R0 is the window handle of the cancel button.
jaschulz#
Well, I tried this in LicenseShow:

GetDlgItem $R0 105 1
SendMessage $R0 WM_SETFOCUS 0 0

But it didn't work. It might be that the call to GetDlgItem is wrong. I am not sure what to use for the "dialog" parameter. I used the number id of the three button dialog from the resource file.

Also, the docs say something about "if you want the handle of a control on the inner dialog..." and I don't understand what the inner dialog is.

Any help would be appreciated.
jaschulz#
Still doesn't work. This is what I have now:

Function LicenseShow
GetDlgItem $R0 $HWNDPARENT 2
SendMessage $R0 WM_SETFOCUS 0 0
FunctionEnd

But the focus still stays on the memo that shows the license text.

Any other ideas?

JAS
jaschulz#
This is what I have now:

Function LicenseShow
GetDlgItem $R0 $HWNDPARENT 2
SendMessage $R0 ${WM_SETFOCUS} 0 0
FunctionEnd

But it's still not working.

JAS
Joost Verburg#
WM_SETFOCUS is actually a notification. To set the focus on a certain button, you should call the SetFocus API using the System plug-in.