Archive: How to set the "Back" button as the default button in the LICENSE page?


How to set the "Back" button as the default button in the LICENSE page?
  Hi every one,

I am using NSIS to write my installer. On the License page, the default button is "I Agree" and I want to set the "Back" button as the default button. Please help me on this issue if
you have experience on this.

Thanks
Hien


I was thinking something like this:


"MUI2.nsh"

>!include "nsDialogs.nsh"
>OutFile "example.exe"
>!insertmacro MUI_PAGE_WELCOME
>!define MUI_PAGE_CUSTOMFUNCTION_SHOW BackFocus
>!insertmacro MUI_PAGE_LICENSE "license.txt"
>!insertmacro MUI_PAGE_FINISH
>!insertmacro MUI_LANGUAGE "English"

>Section
SectionEnd

>Function BackFocus
GetDlgItem$1 $HWNDPARENT 3
${NSD_SetFocus} $1
FunctionEnd
>
But this only sets the cursor to the Back button... The Enter default is still Next. So pressing Space will go Back, but pressing Enter will go Next.

If you want to prevent people from just pressing Enter 10 times to run through the installer without reading the license, you could also try using this:
!define MUI_LICENSEPAGE_CHECKBOX

Are there any ways that pressing Enter key will go back instead of go Next.


This page tells you what message to send to set the default button. The Back button is ID 3 in $HWNDPARENT.


Thanks All,

Now I can set the "Back" button as default button with the following code:

!define IDBACK 3
!define DM_SETDEFID 0x401

GetDlgItem $0 $HWNDPARENT ${IDBACK}
SendMessage $HWNDPARENT ${DM_SETDEFID} ${IDBACK} 0
System::Call "User32::SetFocus(i) i ($0) .r0"

Thank you very much for your helps.
Hien