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

Form losing focus:

Status
Not open for further replies.

hunterspot

Programmer
Jun 3, 2009
22
US
Hi All
I have a problem.
From a form frmStats I am going to another form frmClass by clicking on a command button. On frmClass I do some record update and click on cmdExit which has only one line of code THISFORM.Release() .
When frmClass is unloaded, the previous form frmStats is visible but loses focus. The only way i can get out is by using task manager. This app was working and this thing creeped in suddenly, I don;t know how.
Can any of you sugggest me why/what is causing this?
Thanks in advance.
 
Are you saying that after you close frmClass, frmStats is still inactive?

Tell us more: What's the WindowType setting for each form?

Tamar
 
Yes. When i close frmClass, frmStats is inactive. Both frmStats and frmClass are Modal, Alwaysontop and autocenter checked. Showwindow 'In top level'.
 
There is a difference between "losing focus" and requiring task manager to get out. When you lose focus, just click the window to get it back. If you're needing task manager, you've got bigger issues than just losing focus.

I don't have any suggestions but I'm compelled to ask: WHAT WERE YOU THINKING? <g>

AlwaysOnTop means nothing else can be on top. How can you possibly have two of them at the same time? What did you expect would happen? Likewise, modal means nothing else can come forward until the modal form is closed. How can you have two of them at the same time?

You've set up quite a bar fight. I'm surprised it hasn't been a problem before!

(And I'm guessing that your second form's release is failing. It still has modal focus and is on top, so there you are stuck.)
 
Use the Debugger and step through what happens when you close the second form. That should give you some idea what's wrong.

Tamar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top