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?
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.
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.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.