You can call InstallPopup() to display the panel, GetUserEvent() to wait for the panel, and RemovePopup(0) to remove it.
InstallPopup doesn't cause your code to wait: it just installs and displays a modal dialog box. GetUserEvent with Wait Mode set to wait will wait until an EVENT_COMMIT is generated. GetUserEvent then returns the panel and control that generated the EVENT_COMMIT.
See answers to previous questions
here