JCM
JCM

Reputation: 570

NSIS - onClick not working at all

I have an issue that is driving me crazy: I cannot get the the onClick to work, not even with a simple example:

I've already read the documentation of NSIS, once and again before asking, but it seems something is stuck (yes I'm new in NSIS).

Function button_click
  MessageBox MB_OK "Hi there!"
FunctionEnd

Function fnc_USB_drive_Create
  ...
  ${NSD_CreateButton} 12 74 121 30 "Button1"
  Pop $hCtl_USB_drive_Button1
  ${NSD_OnClick} $hCtl_USB_drive_Button1 button_click
  ...
FunctionEnd    

The button appears on screen, but clicking it does nothing. It's days that I have been working on this.

I have Win7 SP1 64b, and the NSIS + NSIS dialog designer (latest version of all). Anyone have any idea?

Upvotes: 0

Views: 1280

Answers (1)

Anders
Anders

Reputation: 101736

page custom fnc_USB_drive_Create
var hCtl_USB_drive_Button1
!include nsDialogs.nsh

Function fnc_USB_drive_Create
    nsDialogs::Create 1018
    pop $0
    ${NSD_CreateButton} 12 74 121 30 "Button1"
    Pop $hCtl_USB_drive_Button1
    ${NSD_OnClick} $hCtl_USB_drive_Button1 button_click
    nsDialogs::Show
FunctionEnd    
Function button_click
    MessageBox MB_OK "Hi there!"
FunctionEnd

Works fine for me, do you have any other code that might be messing up the dialog?

Upvotes: 1

Related Questions