Passing a variable to a function bound to a OnClicked event

Inside the widget:

• add an even dispatcher with the desired data signature
• have the button’s onClick call the dispatcher and pipe in data
• when the widget gets created (as in the image above), instead of binding to the native button’s onClick, bind it to the newly created dispatcher in the 1st bullet point