Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Top Level Form Disappearing

Status
Not open for further replies.

CCorax

Programmer
Feb 6, 2002
10
US
I created a dialog to prompt for a registration code, etc., when my application runs. I show() the form, then in the following lines of code, collect the user data. Originally, I left the ShowWindow property as In Screen. Everything worked fine.. the dialog appeared, after I close it, the app moves on to the code after show.

However, when I try to set ShowWindow to As Top-Level Form, the form blips on the screen for an instant, and the code moves on. Looking at the Event output, Destroy() fires immediately after Activate(), and the form closes. Any ideas?

Thanks,
C
 
Setting ShowWindow as a Top Level Form automatically makes the form modeless. You have to issue READ EVENTS in the calling program, and you have to make sure that all methods called when you close the window include CLEAR EVENTS.

A tip I picked up on this forum the other day was to include

ON SHUTDOWN DO cleanup

in the calling program, and to make sure that 'Cleanup' contains CLEAR EVENTS. That way you avoid inadvertently sending the remote computer into an unrecoverable loop.

Tony
 
Keep in mind that this WILL NOT WORK if you are already in an event loop! This kind of form would need to be run before you enter your main event loop. You can only have one READ EVENTS at a time. All subsequent READ EVENTS commands will be ignored.

Ian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top