Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 148
  • Last Modified:

select form

i have a icon in the system tray for my application when i double click the icon the to show the app it shows but the other apps still have focus.How cani give the form and bring to top. I tried setfocus and topmostWindow  in windows API.
I use delphi 1. thanx
Mits
0
Mitsy
Asked:
Mitsy
  • 5
  • 4
1 Solution
 
belgianbasmanCommented:
Suppose the form you want to show up is called FORM1.

In the OnResize event of this form, put FORM1.ACTIVATE;

I think this should do it.

0
 
MitsyAuthor Commented:
no the form does not have focus and remains hidden under other apps, when i double click the icon.
Mits
0
 
viktornetCommented:
SetForegroundWindow(FormName.Handle);

Regards,
Viktor Ivanov
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
viktornetCommented:
You could also use this......

FormName.BringToFront;

Regards,
Viktor Ivanov
0
 
MitsyAuthor Commented:
It doesnt work it still does not have focus, i think focus has been given to the icon in the tray
Mits
0
 
viktornetCommented:
It depends on where do you call that......Did you try in OnShow()
0
 
MitsyAuthor Commented:
hey viktornet
i can now bring the form to front with setWindowPos in win API but still cant give focus, the title bar is greyed.
Mitsy
0
 
viktornetCommented:
Would you please send me the project so I can take a loot at it???
0
 
MitsyAuthor Commented:
ok i will
0
 
viktornetCommented:
I sent you some suggestions........You could also try this.....

public
  Procedure ActiveApp(Sender : TObject);
{...}
In OnCreate() enter this code...
Application.OnActivate := ActiveApp;
//The code for the AcitveApp() procedure...
procedure TForm1.ActiveApp(Sender : TObject);
begin
  if Visible then
    Hide
  else
  begin
    if not(GetForegroundWindow = Handle) then
      SetForegroundWindow(Handle);
  end;
end;

Try this if the suggestions I gave you don't work....

Regards,
Viktor Ivanov
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now