Solved

avoiding forms to come to the foreground

Posted on 2001-09-14
9
406 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
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
 
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Virtuailstring tree add node to another virtuailstring tree list 4 115
Magic Software info 18 131
Dev Express grid collapse 2 45
Breakpoint doesn't stop in my variable 3 28
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

809 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