My code looks similar to this:
The callback runs when I click on the button and when I focus on it. I need only click events. Thanks.
${NSD_CreateRadioButton} 1 2 3 4 $R1
Pop $R1
${NSD_OnClick} $R1 OnRadioClick
7 posts
The callback runs when I click on the button and when I focus on it. I need only click events. Thanks.
${NSD_CreateRadioButton} 1 2 3 4 $R1
Pop $R1
${NSD_OnClick} $R1 OnRadioClick
if (HIWORD(wParam) == BN_CLICKED && (ctl->type == NSCTL_BUTTON || ctl->type == NSCTL_LINK))but why does it matter? Why is the focus event causing you trouble?
...generation of BN_CLICKED messages when the button receives focus.You can do
!define /IfNDef BM_SETDONTCLICK 0xF8 ; Vista and later only?
SendMessage $hMyRadio ${BM_SETDONTCLICK} 1 0 but when you use radio buttons, it is important to use groups and "check" one as the default. After that you don't care why you got notified:!include nsDialogs.nsh
Page Custom pre
Function pre
nsDialogs::Create 1018
Pop $0
${NSD_CreateFirstRadioButton} 0 0 40% 6% "Configure $(^Name)"
Pop $1
${NSD_OnClick} $1 RadioChanged
${NSD_CreateAdditionalRadioButton} 0 12% 40% 6% "Just install now"
Pop $2
${NSD_OnClick} $2 RadioChanged
SendMessage $1 ${BM_CLICK} "" "" ; Set a default
nsDialogs::Show
FunctionEnd
Function RadioChanged
Pop $3
GetDlgItem $0 $hWndParent 1
${NSD_GetChecked} $1 $3
${If} $3 <> ${BST_UNCHECKED}
${NSD_SetText} $0 "$(^NextBtn)"
${Else}
${NSD_SetText} $0 "$(^InstallBtn)"
${EndIf}
FunctionEnd