lcl: ignore BorderStyle changes for TForm during the design time (issue #0017099)

git-svn-id: trunk@26993 -
This commit is contained in:
paul 2010-08-03 11:55:11 +00:00
parent 5256b68374
commit 83e5f75727
2 changed files with 19 additions and 17 deletions

View File

@ -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;

View File

@ -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);