I have two custom pages.
In the first custom page, the default button (triggered on <Enter>) is the Next button.
In the second custom page, I set the default button to a different button:
SendMessage $HWNDPARENT ${DM_SETDEFID} 1221 0
But when I click Back going back to the first custom page, the default button there is no longer Next (i.e. <Enter> no longer triggers Next).
How do I set the default button in the first custom page back to Next button?
I tried the following but it doesn't work:
GetDlgItem $1 "$HWNDPARENT" 1
SendMessage $HWNDPARENT ${DM_SETDEFID} $1 0
EDIT:
Code and file structure is actually complicated, but I'll try to simplfiy:
Dialog1.nsh
Function fnc_Dialog1_Create
; create dialog controls here
Call SetupDialog1
FunctionEnd
Function SetupDialog1
; create event handlers here
nsDialogs::Show
FunctionEnd
Dialog2.nsh
Function fnc_Dialog2_Create
; create dialog controls here
${NSD_CreateButton} 217.87u 126.15u 78.33u 14.15u "$(TRANSLATED_DLG_BUTTON_TESTCONNECTION)"
Call SetupDialog2
FunctionEnd
Function SetupDialog2
; create event handlers here
; set Default Button (prevent "Install" on <Enter> by setting default button to a different button
SendMessage $HWNDPARENT ${DM_SETDEFID} 1221 0
nsDialogs::Show
FunctionEnd