Link to home
Start Free TrialLog in
Avatar of Mitsy
Mitsy

asked on

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
Avatar of belgianbasman
belgianbasman

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.

Avatar of Mitsy

ASKER

no the form does not have focus and remains hidden under other apps, when i double click the icon.
Mits
ASKER CERTIFIED SOLUTION
Avatar of viktornet
viktornet
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You could also use this......

FormName.BringToFront;

Regards,
Viktor Ivanov
Avatar of Mitsy

ASKER

It doesnt work it still does not have focus, i think focus has been given to the icon in the tray
Mits
It depends on where do you call that......Did you try in OnShow()
Avatar of Mitsy

ASKER

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
Would you please send me the project so I can take a loot at it???
Avatar of Mitsy

ASKER

ok i will
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