Form on the fly - activate?

  • Thread starter Thread starter Tom Edelbrok
  • Start date Start date
T

Tom Edelbrok

I've created a form on the fly at run-time as "new form". Works fine. I even
add some controls to it (ie: a label control, etc). I then use
"AddOwnedForm" to add my newly created form as an owned form of my main
application form.

Immediately after showing my new form I set "Enabled = False" for the
original application form, disabling and graying it.

However, my new form doesn't have the focus, and I can't figure out how to
give it the focus. I can click on it to get the focus, but I want it to have
the focus automatically. I've tried the "Activate" method and a variety of
other things without success.

Any idea on how to make my new form light up it's Window title bar?

(I thought of raising a click event for the form at run-time but I don't
know how to do that).

Thanks,

Tom Edelbrok
 
What I'm trying to do is:

I have an application that may occasionally run into a startup problem.
Instead of just letting the application evaporate I display a temporary form
indicating what the problem is. This temporary display form automatically
closes after say 10 seconds, closing the application with it. Everything
works great except that the new display form doesn't get highlighted as
desired, nevertheless it runs perfectly otherwise. In addition, it has a
control box 'close' button so that the user can click the 'X' to close the
display message without having to wait 10 seconds for it close
automatically.

What this accomplishes is that for a variety of 7x24 programs we will get a
message right away indicating the problem (ie: when we're trying to restart
the program). Otherwise we would have to open the Event Viewer and check it
out. I like the visual display method better, especially when you're in a
rush.

So what I do is display the temporary form (with an appropriate warning or
error message) and simultaneously disable the application's main form.

Actually the temporary form doesn't need to be owned by the application main
form. I changed it to simply use the "TopMost = TRUE", however it still
behaves the same way, whether owned or not.

Is there another way I can do what I want. It's actually acceptable as is; I
would just like to make it better.

Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top