Solved

Window On Top question

Posted on 1998-11-23
9
168 Views
Last Modified: 2010-04-04
Is there a better way to alter a form between 'StayOnTop' and 'Normal'. I ams setting the forms formstyle property to fsstayontop or fsnormal but I get an anoying flicker when I do this.... Anyone know of a way to toggle between states without flicker?
0
Comment
Question by:davegreen
  • 6
  • 2
9 Comments
 

Author Comment

by:davegreen
ID: 1347720
I just read in the Delphi help that it is inadvisable to alter formstyle at runtime. Many programs let you change between stayontop and normal at run time... Whats the best way?

0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1347721
Try using LockWindowUpdate(Form.Handle) before changing it and LockWindUpdate(0) after changing it.

I am not 100% sure if this will work but its worth a try...

Cheers,

Raymond.
0
 

Author Comment

by:davegreen
ID: 1347722
I tried this one... this on win98 has the side effect of making all icons flash on the desktop, plus the form still flashes :(

0
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
LVL 20

Expert Comment

by:Madshi
ID: 1347723
Try using SetWindowPos with HWND_NOTOPMOST and HWND_TOPMOST...

Regards, Madshi.
0
 

Author Comment

by:davegreen
ID: 1347724
Thanks Madshi... any idea what unit I need to include in the uses clause?
0
 

Author Comment

by:davegreen
ID: 1347725
Madshi, have you got an example of its use. I tried SetWindowPos(hwnd,HWND_TOPMOST,1,1,1,1,SWP_NOMOVE + SWP_NOSIZE) but it fails to compile... any ideas?

0
 

Author Comment

by:davegreen
ID: 1347726
Madshi,
Well, I'm stupid.. as you can see I should have used handle instead of hwnd and it would have compiled.

Anyway.. it WORKS!  .. no flicker!
Answer the question... the points are yours.
Thanks Matshi for pointing me in this direction. :)

0
 
LVL 20

Accepted Solution

by:
Madshi earned 100 total points
ID: 1347727
Great, that it works. Was not sure about it...  :-)

Thanx for the points...

Regards, Madshi.
0
 

Author Comment

by:davegreen
ID: 1347728
Thanks again Madshi :)

0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…

821 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