From 83e5f75727f177949833af0c2f03095f3fdc487b Mon Sep 17 00:00:00 2001 From: paul Date: Tue, 3 Aug 2010 11:55:11 +0000 Subject: [PATCH] lcl: ignore BorderStyle changes for TForm during the design time (issue #0017099) git-svn-id: trunk@26993 - --- lcl/include/customform.inc | 28 +++++++++++++++------------- lcl/interfaces/win32/win32wsforms.pp | 8 ++++---- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/lcl/include/customform.inc b/lcl/include/customform.inc index 2fad26a6a6..e059eaf961 100644 --- a/lcl/include/customform.inc +++ b/lcl/include/customform.inc @@ -1677,7 +1677,6 @@ var AdaptBorderIcons: boolean; begin if FFormBorderStyle = NewStyle then exit; - //TODO: Finish SETBORDERSTYLE // AutoScroll is only available for bsSizeable, bsSizeToolWin windows if not (NewStyle in BorderStylesAllowAutoScroll) then @@ -1687,19 +1686,22 @@ begin (BorderIcons = DefaultBorderIcons[FFormBorderStyle]); FFormBorderStyle := NewStyle; - // if Form had default border icons before change, it should keep the default - if AdaptBorderIcons then - BorderIcons := DefaultBorderIcons[FFormBorderStyle]; - - Include(FFormState, fsBorderStyleChanged); - // ToDo: implement it. - // We can not use inherited SetBorderStyle(NewStyle), - // because TBorderStyle <> TFormBorderStyle; - if HandleAllocated then + if not (csDesigning in ComponentState) then begin - TWSCustomFormClass(WidgetSetClass).SetFormBorderStyle(Self, NewStyle); - Perform(CM_ICONCHANGED, 0, 0); - UpdateMenu; + // if Form had default border icons before change, it should keep the default + if AdaptBorderIcons then + BorderIcons := DefaultBorderIcons[FFormBorderStyle]; + + Include(FFormState, fsBorderStyleChanged); + // ToDo: implement it. + // We can not use inherited SetBorderStyle(NewStyle), + // because TBorderStyle <> TFormBorderStyle; + if HandleAllocated then + begin + TWSCustomFormClass(WidgetSetClass).SetFormBorderStyle(Self, NewStyle); + Perform(CM_ICONCHANGED, 0, 0); + UpdateMenu; + end; end; end; diff --git a/lcl/interfaces/win32/win32wsforms.pp b/lcl/interfaces/win32/win32wsforms.pp index 6e6fcc0d68..63e097aaa9 100644 --- a/lcl/interfaces/win32/win32wsforms.pp +++ b/lcl/interfaces/win32/win32wsforms.pp @@ -371,7 +371,7 @@ begin pClassName := @ClsName[0]; WindowTitle := StrCaption; AdjustFormBounds(lForm, Bounds); - if lForm.Position in [poDefault, poDefaultPosOnly] then + if (lForm.Position in [poDefault, poDefaultPosOnly]) and not (csDesigning in lForm.ComponentState) then begin Left := CW_USEDEFAULT; Top := CW_USEDEFAULT; @@ -381,7 +381,7 @@ begin Left := Bounds.Left; Top := Bounds.Top; end; - if lForm.Position in [poDefault, poDefaultSizeOnly] then + if (lForm.Position in [poDefault, poDefaultSizeOnly]) and not (csDesigning in lForm.ComponentState) then begin Width := CW_USEDEFAULT; Height := CW_USEDEFAULT; @@ -401,12 +401,12 @@ begin end; SetStdBiDiModeParams(AWinControl, Params); // create window - FinishCreateWindow(AWinControl, Params, false); + FinishCreateWindow(AWinControl, Params, False); Result := Params.Window; // remove system menu items for bsDialog - if lForm.BorderStyle = bsDialog then + if (lForm.BorderStyle = bsDialog) and not (csDesigning in lForm.ComponentState) then begin SystemMenu := GetSystemMenu(Result, False); DeleteMenu(SystemMenu, SC_RESTORE, MF_BYCOMMAND);