Turns out, Cancel doesn’t return a callback for some reason.
Ignore, Abort and No are working.
So, to make sure Close button sends callback to the backend, you need to add to your px:PXSmartPanel declaration in markup this:
CloseButtonDialogResult="Abort"
If you decide to use No result, you can check it along with the Cancel result using:
if (dialogResult.IsNegative())
{
return adapter.Get();
}
IsNegative checks dialog result against No and Cancel specifically - so if you use Abort or Ignore, the result of the check will be false.
If you want to use Abort or Ignore, you will have to check values against each possible result:
if(dialogResult == WebDialogResult.Abort || dialogResult == WebDialogResult.Cancel)
{
return adapter.Get();
}
Regarding OnClosingPopup:
OnClosingPopup, according to the XML documentation:
Gets or sets the special type of the button that will be triggerred on closing of an application webpage that is opened in popup mode.
I’ve highlighted the “an application webpage” part because that’s the reason it doesn’t help you - it affects the screen with the action, but only when the action opens a new page in the popup - for example, by using PXPopupRedirectException or PXRedirectRequiredException exception. You open Smart Panel, which is a part of the same screen, so it operates differently.