Link to home
Start Free TrialLog in
Avatar of toesable
toesable

asked on

Problems with modal forms

We have ported a p-system based program into delphi and have some limitations at the present time which make it necessary for us to use showmodal on all of our forms. (About 80 such forms)  

The problem is that on occasion if there is another application running it will take the focus from our application while we are setting our main form visible/invisible or freeing one of the subforms. i.e. if we have a dos box up and we change from one form to another the dos box suddenly (and occasionally) will jump in front of the form we are bringging up.  In addition, sometimes this other application becomes the active application and sometimes it's just in front of our form.  Anyone got any clues how to get rid of this problem?
Avatar of rwilson032697
rwilson032697

Listening
Try using SetForegroundwindow.


Good luck!!
In your form.formstyle property set it to fsStayOnTop that should work.
If you dont want the form always on top you can toggle the style when you want to.
Avatar of toesable

ASKER

Checking
Sorry flooder, this doesn't work because it takes over the computer completely.  Only if our program is the active program do we want to make sure we keep focus.  Dr Delphi's answer is a good one and it lead us to bringtofront in delphi.  We are currently testing that.  Any other suggestions are appreciated.
ASKER CERTIFIED SOLUTION
Avatar of DrDelphi
DrDelphi

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you DrDelphi, over the past few days we have come to the same conclusion.  

Take care
toe
de nada.