• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 158
  • Last Modified:

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?
0
toesable
Asked:
toesable
1 Solution
 
rwilson032697Commented:
Listening
0
 
DrDelphiCommented:
Try using SetForegroundwindow.


Good luck!!
0
 
flooderCommented:
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.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
toesableAuthor Commented:
Checking
0
 
toesableAuthor Commented:
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.
0
 
DrDelphiCommented:
BringToFront will work within the scope of your application, but if you want to make the form the topmost within Windows, you'll either have to go with the API I suggested (SetForegroundwindow), or SetWindowPos (another API)

Good luck!!
0
 
toesableAuthor Commented:
Thank you DrDelphi, over the past few days we have come to the same conclusion.  

Take care
toe
0
 
DrDelphiCommented:
de nada.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now