[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Making a form "fsStayOnTop"

Posted on 1998-06-24
14
Medium Priority
?
926 Views
Last Modified: 2008-02-01
Forms with the formstyle property set to fsStayOnTop only stay on top when they are the MainForm.

How do you make a non MainForm stay on Top?

(Delphi 3)
0
Comment
Question by:greenrc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
  • 2
  • +5
14 Comments
 
LVL 5

Expert Comment

by:inter
ID: 1355575
Hi,
Please explain the case more. I just make a test, set form2 stay on top while form1 is the main form and form2 stays on top of form1. Do you want your any form to stay on top of other applications?
Igor
0
 

Author Comment

by:greenrc
ID: 1355576
Igor,

Form1 is the mainform.
When form1 is hidden and form2 shown, form2 does not remain on top of other applications, regardless of the formstyle being set to fsStayOnTop.


0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1355577
Hi greenrc,

 Does this work? I've got it from somewhere but I don't know anymore from where...

 Form2.SetWindowPos(Handle,
                    HWND_TOPMOST,
                    Left,
                    Top,
                    Width,
                    Height,
                    SWP_NOACTIVATE or SWP_NOMOVE or SWP_NOSIZE);

 Try to put it in some events, like OnShow, ...

Zif.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:greenrc
ID: 1355578
Delphi 3 - Forms do not have a method 'SetWindowPos'
0
 
LVL 4

Expert Comment

by:BoRiS
ID: 1355579
greenrc

SetWindowPos is an API call, I think Zif meant pass it like so...

procedure TForm1.FormShow(Sender: TObject);
begin
 SetWindowPos(Handle,
                          HWND_TOPMOST,
                          Left,
                          Top,
                          Width,
                          Height,
                          SWP_NOACTIVATE or SWP_NOMOVE or SWP_NOSIZE);
end;

anyway try this and see if it works...(above)

Later
BoRiS
0
 

Author Comment

by:greenrc
ID: 1355580
Still does not remain on top of other applications....


0
 

Author Comment

by:greenrc
ID: 1355581
Adjusted points to 200
0
 
LVL 5

Expert Comment

by:ronit051397
ID: 1355582
try SetForegroundWindow or  BringWindowToTop
0
 

Author Comment

by:greenrc
ID: 1355583
Does not work for forms that are not the main form.
0
 
LVL 4

Expert Comment

by:d003303
ID: 1355584
..seems to be a bug in the forms unit.

Slash/d003303
0
 
LVL 2

Accepted Solution

by:
333 earned 400 total points
ID: 1355585
{It is working in Delphi2}

procedure TForm1.Button1Click(Sender: TObject);
begin
{at design time set Form2.FormStyle to fsNormal}  
  form2.show;
  form2.formstyle:=fsStayOnTop;
end;

{Form2 onDeactivate event}
procedure TForm2.FormDeactivate(Sender: TObject);
begin
 BringWindowToTop(Handle);
end;
0
 

Expert Comment

by:bome
ID: 1355586
I don't think that it is a real bug - or an intended bug. I always use fsStayOnTop for secondary windows and want that they only stay on top of my main window - not on top of all other windows on the desktop.
Imagine floating toolbars, etc. They always have this behavior.

bome

PS: d003303, you ruined me by giving me the hint to check out experts exchange... I'm hooked ! (I'm the guy in France who extended your drop wrapper)

0
 
LVL 4

Expert Comment

by:d003303
ID: 1355587
Yo bome,
nice place here, isn't it ;-)
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1355588
heck, heck, dear bome. I guess everybody here is hooked... we can't stop looking at E-E everyday. Zif. ;-)
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question