// UInventoryWidget::OnCloseButtonClicked is a function that you want to execute when the button is clicked Button->OnClicked.AddUniqueDynamic(this, &UInventoryWidget::OnCloseButtonClicked);