checkboxinstallationnsiscustom-pagesnsdialogs

NSIS installer nsDialog checkbox not appearing as I think it should


I'm adding a custom page to an NSIS installer and I'm having trouble adding a checkbox. All the examples I've seen look the same, which is what I'm doing, but I can't see what could be wrong. (I've only been using NSIS for an hour or so!).

!include MUI2.nsh
!include WordFunc.nsh
!insertmacro VersionCompare
!include LogicLib.nsh
!include InstallOptions.nsh
!include nsDialogs.nsh

Name "xxxxx"
;!define MUI_ICON "bcs.ico"
;!define MUI_HEADERIMAGE
;!define MUI_HEADERIMAGE_BITMAP "bcs.bmp"
;!define MUI_WELCOMEFINISHPAGE_BITMAP "bcs164.bmp"
;!define MUI_HEADERIMAGE_RIGHT

OutFile "nqcs_setup.exe"
InstallDir "$PROGRAMFILES\xxxx"
InstallDirRegKey HKLM "Software\xxxx" "InstallDir"
RequestExecutionLevel admin

Var Dialog
Var Heading
Var ServiceQuestion
Var SvcCheckBox

Function installOptionsPage

    nsDialogs::Create 1018
    Pop $Dialog

    ${If} $Dialog == error
        Abort
    ${EndIf}

    ${NSD_CreateLabel} 0 0 100% 50 "Installation Options"
    Pop $Heading
    CreateFont $0 "$(^Font)" "14" "500"
    SendMessage $Heading ${WM_SETFONT} $0 1

    ${NSD_CreateLabel} 0 50 100% 20 "Would you like to install as a service?"
    Pop $ServiceQuestion
    CreateFont $0 "$(^Font)" 11
    SendMessage $ServiceQuestion ${WM_SETFONT} $0 1

    ${NSD_CreateCheckbox} 50 50 100% 15 "Checkbox Test"
    Pop $SvcCheckBox
    ;GetFunctionAddress $0 OnCheckbox
    nsDialogs::OnClick $SvcCheckBox $0

    nsDialogs::Show

FunctionEnd

When the page appears the check box isn't there:

nsis nsdialog check box problem


Solution

  • My issue was rather silly. The Label was simply above the check box, rendering it invisible. My mistake.