Click here to Skip to main content
15,890,579 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello!
I have two forms: form “A” and form “B”:

http://ib3.keep4u.ru/b/2013/06/13/66/66de96e869ae82bf7e549e1d0603e51b.jpg[^]

- the style of the form "A" is "fsStayOnTop" - on top of all windows;
- the style of the form "B" is also "fsStayOnTop" - on top of all windows of its parent.

When I click on form “A” - form “B” does not lost focus - it's good.
Problem: when clicking outside of the form “A”, the form “B” lost its focus (is hiding behind the form "A") – this actually is the problem.

Tell me how to solve the problem? I need: when I click outside of the form "A", form "B" must be remained at its original position (higher than form “A” like in the picture).
Posted
Updated 13-Jun-13 3:26am
v3
Comments
Philippe Mori 14-Jun-13 12:40pm    
You should rarely use "top-most" style for top-level Windows. And if you do, it should typically be optional.

I think the only reliable way to achieve this is to make "B" a child of "A" meaning that it cannot appear outside the client area of A and always get painted on top of A. Otherwise you're fighting both the the window manager and the user and that is a battle you're going to loose.

This is all assuming your working on Microsoft Windows and these forms are fully qualified Windows windows not WPF fake windows or something of that sort.
 
Share this answer
 
Comments
Philippe Mori 14-Jun-13 12:37pm    
It is also possible to specify the owner of the Windows. Generally an owner is behind owned Windows.
Have you considered removing the fsStayOnTop option from form A when opening form B and readding it when B is closed?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900