From 8387ee8302a4c8eb99adfea2413a4d9267efa047 Mon Sep 17 00:00:00 2001 From: paul Date: Mon, 28 Mar 2011 07:12:19 +0000 Subject: [PATCH] win32: don't clear WS_CHILD and other unrelated to border style/border icon flags on form handle creation, fix handling of WS_CHILD forms (can be either parent <> nil or ParentWindow <> 0) git-svn-id: trunk@30046 - --- lcl/interfaces/win32/win32callback.inc | 2 +- lcl/interfaces/win32/win32wsforms.pp | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lcl/interfaces/win32/win32callback.inc b/lcl/interfaces/win32/win32callback.inc index 7d344244c9..dfb7520db6 100644 --- a/lcl/interfaces/win32/win32callback.inc +++ b/lcl/interfaces/win32/win32callback.inc @@ -2255,7 +2255,7 @@ begin Msg := LM_MOVE; // MoveType := WParam; WParam is not defined! MoveType := Move_SourceIsInterface; - if (lWinControl is TCustomForm) and (TCustomForm(lWinControl).Parent = nil) then + if (lWinControl is TCustomForm) and (GetWindowLong(Window, GWL_STYLE) and WS_CHILD = 0) then begin WindowPlacement.length := SizeOf(WindowPlacement); if IsIconic(Window) and GetWindowPlacement(Window, @WindowPlacement) then diff --git a/lcl/interfaces/win32/win32wsforms.pp b/lcl/interfaces/win32/win32wsforms.pp index ce13c1637f..6a03c17ba5 100644 --- a/lcl/interfaces/win32/win32wsforms.pp +++ b/lcl/interfaces/win32/win32wsforms.pp @@ -273,16 +273,16 @@ procedure CalcFormWindowFlags(const AForm: TCustomForm; var Flags, FlagsEx: DWOR var BorderStyle: TFormBorderStyle; begin - BorderStyle := GetDesigningBorderStyle(AForm); - Flags := BorderStyleToWin32Flags(BorderStyle); - if AForm.Parent <> nil then - Flags := (Flags or WS_CHILD) and not WS_POPUP; - // clear border style flags - FlagsEx := FlagsEx and not (WS_EX_DLGMODALFRAME or WS_EX_WINDOWEDGE or WS_EX_TOOLWINDOW); + // clear all styles which can be set by border style and icons + Flags := Flags and not (WS_POPUP or WS_BORDER or WS_CAPTION or WS_THICKFRAME or + WS_DLGFRAME or WS_MINIMIZEBOX or WS_MAXIMIZEBOX or WS_SYSMENU); + FlagsEx := FlagsEx and not (WS_EX_DLGMODALFRAME or WS_EX_WINDOWEDGE or + WS_EX_TOOLWINDOW or WS_EX_CONTEXTHELP); // set border style flags + BorderStyle := GetDesigningBorderStyle(AForm); + Flags := Flags or BorderStyleToWin32Flags(BorderStyle); FlagsEx := FlagsEx or BorderStyleToWin32FlagsEx(BorderStyle); - if (AForm.FormStyle in fsAllStayOnTop) and - not (csDesigning in AForm.ComponentState) then + if (AForm.FormStyle in fsAllStayOnTop) and not (csDesigning in AForm.ComponentState) then FlagsEx := FlagsEx or WS_EX_TOPMOST; Flags := Flags or CalcBorderIconsFlags(AForm); FlagsEx := FlagsEx or CalcBorderIconsFlagsEx(AForm);