diff --git a/lcl/interfaces/win32/win32object.inc b/lcl/interfaces/win32/win32object.inc index 7cb8df231b..d15585cb3b 100644 --- a/lcl/interfaces/win32/win32object.inc +++ b/lcl/interfaces/win32/win32object.inc @@ -421,7 +421,7 @@ var AWinControl: TWinControl; begin AMenu := AMenuObject as TMenu; - if AMenu.FCompStyle = csMainMenu then + if AMenu is TMainMenu then begin AWinControl := TWinControl(AMenu.Owner); Windows.SetMenu(AWinControl.Handle, AMenu.Handle); @@ -736,6 +736,9 @@ end; { $Log$ + Revision 1.297 2004/11/02 17:48:19 micha + remove usage of fcompstyle + Revision 1.296 2004/11/01 18:20:21 micha set default icon instead of lcl icon which actually is a bitmap diff --git a/lcl/interfaces/win32/win32wscontrols.pp b/lcl/interfaces/win32/win32wscontrols.pp index 3092838978..e51a56723c 100644 --- a/lcl/interfaces/win32/win32wscontrols.pp +++ b/lcl/interfaces/win32/win32wscontrols.pp @@ -291,27 +291,8 @@ begin end; procedure TWin32WSWinControl.SetBounds(const AWinControl: TWinControl; const ALeft, ATop, AWidth, AHeight: Integer); -var - SizeRect: Windows.RECT; begin - with SizeRect do - begin - Left := ALeft; - Top := ATop; - Right := ALeft + AWidth; - Bottom := ATop + AHeight; - end; - case AWinControl.FCompStyle of - csForm: - begin - // the LCL defines the size of a form without border, win32 with. - // -> adjust size according to BorderStyle - Windows.AdjustWindowRectEx(@SizeRect, BorderStyleToWin32Flags(TCustomForm(AWinControl).BorderStyle), false, - BorderStyleToWin32FlagsEx(TCustomForm(AWinControl).BorderStyle)); - end; - end; - TWin32WidgetSet(InterfaceObject).ResizeChild(AWinControl, ALeft, ATop, - SizeRect.Right - SizeRect.Left, SizeRect.Bottom - SizeRect.Top); + TWin32WidgetSet(InterfaceObject).ResizeChild(AWinControl, ALeft, ATop, AWidth, AHeight); end; procedure TWin32WSWinControl.SetColor(const AWinControl: TWinControl); diff --git a/lcl/interfaces/win32/win32wsforms.pp b/lcl/interfaces/win32/win32wsforms.pp index 1179222573..58dfd2a92f 100644 --- a/lcl/interfaces/win32/win32wsforms.pp +++ b/lcl/interfaces/win32/win32wsforms.pp @@ -84,6 +84,8 @@ type const ABorderIcons: TBorderIcons); override; class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): HWND; override; + class procedure SetBounds(const AWinControl: TWinControl; const ALeft, ATop, + AWidth, AHeight: Integer); override; class procedure SetIcon(const AForm: TCustomForm; const AIcon: HICON); override; class procedure ShowModal(const ACustomForm: TCustomForm); override; end; @@ -235,6 +237,29 @@ begin WS_SYSMENU or WS_MINIMIZEBOX or WS_MAXIMIZEBOX); end; +procedure TWin32WSCustomForm.SetBounds(const AWinControl: TWinControl; + const ALeft, ATop, AWidth, AHeight: Integer); +var + SizeRect: Windows.RECT; +begin + // the LCL defines the size of a form without border, win32 with. + // -> adjust size according to BorderStyle + with SizeRect do + begin + Left := ALeft; + Top := ATop; + Right := ALeft + AWidth; + Bottom := ATop + AHeight; + end; + Windows.AdjustWindowRectEx(@SizeRect, BorderStyleToWin32Flags( + TCustomForm(AWinControl).BorderStyle), false, + BorderStyleToWin32FlagsEx(TCustomForm(AWinControl).BorderStyle)); + + // rect adjusted, pass to inherited to do real work + TWin32WSWinControl.SetBounds(AWinControl, ALeft, ATop, SizeRect.Right - SizeRect.Left, + SizeRect.Bottom - SizeRect.Top); +end; + procedure TWin32WSCustomForm.SetIcon(const AForm: TCustomForm; const AIcon: HICON); begin SendMessage(AForm.Handle, WM_SETICON, ICON_BIG, Windows.LoadIcon(MainInstance, 'MAINICON'));