View Single Post
Old Oct 28th, 2005, 10:01 AM   #1
ekamaloff
Newbie
 
Join Date: Oct 2005
Posts: 3
Rep Power: 0 ekamaloff is on a distinguished road
Forms z-ordering problem

Hi! There's one little problem that torments me already for two days. Project I work with is too complex to describe it here, so I try to simplify task. Imagine you have simple application with one main form and one topmost form (FormStyle = fsStayOnTop). Topmost form is always above the main form (even if it is deactivated).

I need to have one more form that should action as another application. E.g. it should have separate button in taskbar, so user can switch to it by clicking on this button (also user can switch to this window by alt-tab).

To achieve such behavior I override method CreateParams, setting WndParent to 0:

type
  TfrmSeparateForm = class(TForm)
  protected
  	procedure CreateParams(var Params: TCreateParams); override;
  end;

implementation

{$R *.DFM}

procedure TfrmSeparateForm.CreateParams(var Params: TCreateParams);
begin
    inherited;
    Params.WndParent := 0;
end;

Everything works as I want except one little thing: when I try to bring this form to top, it stays above main form but behind the topmost one.. Please advise how to make this form appear above the topmost form. Thank you for help.

PS:
don't advise to make this form topmost.
ekamaloff is offline   Reply With Quote