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 sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Child Form, Parent Form On Close focus

Status
Not open for further replies.

goodmanrAy

Programmer
Feb 6, 2002
53
GB
Hi

I am writing an app which needs to alert a user at some point in it's process.

I am creating a child form to alert the user, I want the child form to pop up as the top most window and stay there until closed.

I have managed to acheive this by override on the procedure CreateParams.

However when I close the child form the main form becomes the topmost window, I want the main form to stay where it is and not to become the focus so as not to interfere with what the user is doing already, like outlook does with the new message alert dialog.

Any ideas?

Thanks

Andrew
 
Dont fully understand what you are trying to do here.
Some general stuff on form opening, assuming you are Not talking about MIDIChild forms here.

Its easy to make a new form popup and stay until the user closes it, by calling the form modaly.

e.g.
newform.showmodal

the form that was the parent/open when the newform was called will always recive focus when the modal window closes.
I dont uderstand what it is that the users will have been doing if they were not using the calling form. when the child form window is displayed.

A form that users can work behind (they dont have to close it before they can do anything else) can be called simply by makinging it invisible by default then
doing
newform.show;
newform.bringtofront;

If you mean your application is running in the background when the window pops up (due to an external or timed event)
then you could use:-

if newform.showmodal = MrOK then
some code to minimise your application again

You might need to get a handle from the active window (if it is another application) so you can give focus back to that window, or nothing will have focus. But is that a problem?




Steve
Be excellent to each other and Party on!
 
Hi Steve thanks for the reply.

The system monitors the exchange server for specific types of email. When exchange receives this type of email it alerts the user. The main form is running constantly, so if an alert is triggered I want it to fire off the alert child form and continue processing, so it can't be modal.

I have found a kind of work around, by setting the alert child form parentWindow = getDesktopWindow.


I am basically trying to recreate the new message dialog on outlook.


cheers

Andrew
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top