Form with FormStyle fsStayOnTop behaves different in Lazarus vs Delphi if it is not MainForm
Original Reporter info from Mantis: Bart @flyingsheep
-
Reporter name: Bart Broersma
Original Reporter info from Mantis: Bart @flyingsheep
- Reporter name: Bart Broersma
Description:
In Delphi if you set FormStyle to fsStayOnTop for a form that is not the mainform, the form only stays on top in relation to the forms of the own application, not to other apps.
Example:
var AForm: TForm;
procedure ShowtestForm;
begin
if not Assigned(AForm) then
begin
AForm := TForm.Create(Self);
AForm.Height := 100;
AForm.Width := 200;
AForm.Caption := 'NonModal Form';
AForm.BorderStyle := bsDialog;
AForm.Top := Top + 50;
AForm.Left := Left + Width - AForm.Width - 50;
AForm.FormStyle := fsStayOnTop;
end;
AForm.Show;
end;
This creates and shows a non-modal form over the form that it was called from.
Now if you click on the mainfom, the non-modal form looses focus, but it still is visible over the mainform (in Delphi that is).
Now if you move a window from another application (say notepad) over it, it disappears out of sight.
If you do this in Lazarus, the non-modal window stays on top of the window from the other apllication (it stays on top of everything).
I think the Delphi way is the preferred one, because it is very usefull to create non-modal dialogs (like find/replace) that stay on top of the "calling" form/application, but not on top of other applications.
Currently I'm in the process of patching the TFindDialog and TReplaceDialog and frankly it needs this feature, otherwise it just looks silly.