I think you need to transfer focus from the button back to the main window after it's pressed. Something like
Case $401 button stuff ActivateGadget mainwindow
Case $401 button stuff ActivateGadget mainwindow