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

fsStayOnTop not working

Status
Not open for further replies.

Ronin441

Programmer
Feb 22, 2002
128
AU
I'm trying to make a form stay on top of all other applications, by using FormStyle := fsStayOnTop. I've set it at design time; I've set it at run time; I've messed with Application.RestoreAllTopmosts, all to no avail. Any tips?
 
Hi,

The older version of delphi have problems with the fsStayOntop property. When you are using delphi 5 their shouldn't be any problem.

Steph
 
I should have thought to mention my version: I am in fact already using Delphi 5 Professional, update pack 1.
 
hi,

we are also using Delphi 5 Enterprise update Pack 1 on Windows XP. We took a new project and set the property fsStayOnTop. It just works fine. So perhaps their is something in your code what isn't working the way it should be.

Steph
 
I followed your lead, and created a simple project with one form, and set its FormStyle to fsStayOnTop. As you suggested, it worked perfectly.

But in my real app, the form that is failing to stay on top is not the main form -- the app opens with a splash window (which is the main form), which then opens the form that I want to stay on top, and hides itself. So, to my sample toy app I added a second form, and a button on the first form, which does Form2.Show.

And this indeed does not work. Form2.FormStyle is set to fsStayOnTop, but it doesn't stay on top of all apps, only on top of Form1. If I set the FormStyle of _both_ forms to fsStayOnTop, then Form1 stays on top until I click the button to open Form2, at which point neither form stays on top.

Hmm.

So I changed my real app such that the form that I want to stay on top is indeed the main form, and the splash gets shown in Form1.Activate. This works around the problem and gets me where I want to be -- the main form continues to stay in front of other apps. I'm still in the situation that if I display the splash window a second time or display another form then I lose my StayOnTop-ness and can't get it back; but this is a minor problem by comparison, and I can happily live with it.

Thanks for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top