Solved

avoiding forms to come to the foreground

Posted on 2001-09-14
9
397 Views
Last Modified: 2010-04-06
I have several forms in my app(that have 'Application' as parent).
when I click one of them all the other forms come to the foreground
(in relation to other app's forms that exist on the screen and NOT
to the foreground of every form, includind the ones in the same app)

I want only the form I clicked to be selected leaving all the other
forms on their respective Z order.



   Thaks in advance

         Filipe Correia
0
Comment
Question by:filipecorreia
  • 5
  • 2
  • 2
9 Comments
 
LVL 3

Accepted Solution

by:
cubud earned 200 total points
ID: 6485982
In each form you want to behave in this way do this

type
  TForm2 = class(TForm)
  private
    { Private declarations }
  public
    { Public declarations }
    procedure CreateParams(var Params: TCreateParams); override;
  end;

procedure TForm2.CreateParams(var Params: TCreateParams);
begin
  inherited;
  Params.WndParent := GetDesktopWindow;
end;

This makes the desktop the owner of this form.  This means that minimizing the main form or bringing it to the foreground does not affect this form.

Taken from http://www.howtodothings.com/showarticle.asp?article=16


Pete
====
http://www.HowToDoThings.com (Articles)
http://www.Stuckindoors.com/delphi (Open source)
0
 
LVL 1

Author Comment

by:filipecorreia
ID: 6486989
Hi
I think your answer may be what I need but I need some more info.
I'm really using C++ Builder but I think this code will work also. only... maybe somethings I have to do in a different way. I have some questions about that:


why is "override;" called? I guess it is only to state that the fuction will be overriden. is that right?

Why is "inherited;" called? is it to call the original function(before it was overriden)?


  Thanks in advance

        Filipe Correia
0
 
LVL 1

Author Comment

by:filipecorreia
ID: 6491651
I've been doing some researching and I think that I now know how to do it in C++.
Any way... if you can help me on this part I would appreciate it.


   Thanks
 
         Filipe Correia
0
 
LVL 3

Expert Comment

by:cubud
ID: 6493083
The answer I gave was correct.
You asked how to do something in Delphi not C++Builder !  

My answer is still correct, you just need to translate into C++ Builder.

Override is called because you want the original control to call our new CreateParams rather than its own.  I call inherited before our new code so that we can get the original result and then modify it.

Pete
====
http://www.HowToDoThings.com (Delphi Articles)
http://www.Stuckindoors.com/delphi (Open source)
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 1

Author Comment

by:filipecorreia
ID: 6499181
Hi


It's working... I've done as you said and the app is behaving like I whanted it to. Except...

There's only an issue left about wich I hope you can help me.
In my app I have a system tray Icon. When I click in it, to bring up it's popup
menu, the last form that had focus comes to the foreground of any other form.
This wasn't supose to hapen. By clicking the system tray icon the popup menu
should appear (as it does) but the any form's z order should remain intact.


    Thank you again

          Filipe Correia


PS:
> This issue is worth some extra points if you can help me
> Thanks for the sites. They've been very useful
0
 
LVL 17

Expert Comment

by:geobul
ID: 9308071
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

accept cubud's comment as answer

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Thanks,

geobul
EE Cleanup Volunteer
0
 
LVL 1

Author Comment

by:filipecorreia
ID: 9312896
I agree, this question should be cleaned up.

   Cheers,
       Filipe
0
 
LVL 17

Expert Comment

by:geobul
ID: 9329564
Hi Filipe,

You may close it yourself by accepting cubud's comment as answer. Otherwise site moderators will.

Regards, Geo
0
 
LVL 1

Author Comment

by:filipecorreia
ID: 9335249
done :)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
loading dll from external path 1 211
Is it possible to connect Database from Mobile APK to Website MySQL 3 65
Delphi - replicating a form 8 65
Multiple image collision 13 69
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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

896 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now