AnchorDocking: Fixed third bug with option FloatingWindowsOnTop - loading layout in OnCreate doesn't permute this option. Issue #19272

git-svn-id: trunk@65051 -
This commit is contained in:
michl 2021-04-22 18:47:05 +00:00
parent 6c6ce16b28
commit 6f18e2cc44

View File

@ -2785,19 +2785,25 @@ end;
procedure TAnchorDockMaster.SetFloatingWindowsOnTop(AValue: boolean); procedure TAnchorDockMaster.SetFloatingWindowsOnTop(AValue: boolean);
var var
i, AIndex: Integer; i, AIndex: Integer;
AForm, ParentForm: TCustomForm; AMainForm, AForm, ParentForm: TCustomForm;
IsMainForm: Boolean; IsMainForm: Boolean;
AFormStyle: TFormStyle; AFormStyle: TFormStyle;
begin begin
if FFloatingWindowsOnTop = AValue then Exit; if FFloatingWindowsOnTop = AValue then Exit;
FFloatingWindowsOnTop := AValue; FFloatingWindowsOnTop := AValue;
AMainForm := nil;
for i:=0 to Screen.FormCount-1 do for i:=0 to Screen.FormCount-1 do
begin begin
AForm := Screen.Forms[i]; AForm := Screen.Forms[i];
ParentForm := GetParentForm(AForm); ParentForm := GetParentForm(AForm);
IsMainForm := (AForm = Application.MainForm) // Workaround: if FloatingWindowsOnTop is loaded on MainForm.Create
or (AForm.IsParentOf(Application.MainForm)) // Application.MainForm is not set now, but already in Screen.Forms
or (ParentForm = Application.MainForm); // see https://bugs.freepascal.org/view.php?id=19272
if not Assigned(AMainForm) then AMainForm := Application.MainForm;
if not Assigned(AMainForm) then AMainForm := Screen.Forms[0];
IsMainForm := (AForm = AMainForm)
or (AForm.IsParentOf(AMainForm))
or (ParentForm = AMainForm);
if IsMainForm then Continue; if IsMainForm then Continue;
if AValue then if AValue then
AFormStyle := fsStayOnTop AFormStyle := fsStayOnTop