Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

avoiding forms to come to the foreground

Posted on 2001-09-14
9
Medium Priority
?
448 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
[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
9 Comments
 
LVL 3

Accepted Solution

by:
cubud earned 600 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

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…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

618 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