mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 13:50:06 +02:00
LCL + Designer: A new flag TWinControl.DesignerDeleting. Make TPairSplitter use it. Issue #26618
git-svn-id: trunk@46072 -
This commit is contained in:
parent
b6da8dd7a5
commit
9d6fca6e69
@ -2991,6 +2991,9 @@ Begin
|
|||||||
// remove all child controls owned by the LookupRoot
|
// remove all child controls owned by the LookupRoot
|
||||||
if (APersistent is TWinControl) then begin
|
if (APersistent is TWinControl) then begin
|
||||||
AWinControl:=TWinControl(APersistent);
|
AWinControl:=TWinControl(APersistent);
|
||||||
|
// Component may to auto-create new components during deletion unless informed.
|
||||||
|
// ComponentState does not have csDestroying yet when removing children.
|
||||||
|
AWinControl.DesignerDeleting := True;
|
||||||
i:=AWinControl.ControlCount-1;
|
i:=AWinControl.ControlCount-1;
|
||||||
while (i>=0) do begin
|
while (i>=0) do begin
|
||||||
ChildControl:=AWinControl.Controls[i];
|
ChildControl:=AWinControl.Controls[i];
|
||||||
@ -3005,6 +3008,7 @@ Begin
|
|||||||
end else
|
end else
|
||||||
dec(i);
|
dec(i);
|
||||||
end;
|
end;
|
||||||
|
AWinControl.DesignerDeleting := False;
|
||||||
end;
|
end;
|
||||||
// remove component
|
// remove component
|
||||||
{$IFDEF VerboseDesigner}
|
{$IFDEF VerboseDesigner}
|
||||||
|
@ -1893,6 +1893,7 @@ type
|
|||||||
FDoubleBuffered: Boolean;
|
FDoubleBuffered: Boolean;
|
||||||
FDockSite: Boolean;
|
FDockSite: Boolean;
|
||||||
FUseDockManager: Boolean;
|
FUseDockManager: Boolean;
|
||||||
|
FDesignerDeleting: Boolean;
|
||||||
procedure AlignControl(AControl: TControl);
|
procedure AlignControl(AControl: TControl);
|
||||||
function GetBrush: TBrush;
|
function GetBrush: TBrush;
|
||||||
function GetControl(const Index: Integer): TControl;
|
function GetControl(const Index: Integer): TControl;
|
||||||
@ -2120,6 +2121,7 @@ type
|
|||||||
property Showing: Boolean read FShowing; // handle visible
|
property Showing: Boolean read FShowing; // handle visible
|
||||||
property UseDockManager: Boolean read FUseDockManager
|
property UseDockManager: Boolean read FUseDockManager
|
||||||
write SetUseDockManager default False;
|
write SetUseDockManager default False;
|
||||||
|
property DesignerDeleting: Boolean read FDesignerDeleting write FDesignerDeleting;
|
||||||
property VisibleDockClientCount: Integer read GetVisibleDockClientCount;
|
property VisibleDockClientCount: Integer read GetVisibleDockClientCount;
|
||||||
public
|
public
|
||||||
// size, position, bounds
|
// size, position, bounds
|
||||||
|
@ -170,19 +170,26 @@ end;
|
|||||||
procedure TPairSplitterSide.SetParent(AParent: TWinControl);
|
procedure TPairSplitterSide.SetParent(AParent: TWinControl);
|
||||||
var
|
var
|
||||||
ASplitter: TCustomPairSplitter;
|
ASplitter: TCustomPairSplitter;
|
||||||
|
DeletingSplitter: Boolean;
|
||||||
begin
|
begin
|
||||||
CheckNewParent(AParent);
|
CheckNewParent(AParent);
|
||||||
// remove from side list of old parent
|
// remove from side list of old parent
|
||||||
ASplitter := Splitter;
|
ASplitter := Splitter;
|
||||||
if ASplitter <> nil then
|
if ASplitter <> nil then begin
|
||||||
ASplitter.RemoveSide(Self);
|
ASplitter.RemoveSide(Self);
|
||||||
|
DeletingSplitter := (csDestroying in ASplitter.ComponentState) or DesignerDeleting;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
DeletingSplitter := False;
|
||||||
|
|
||||||
inherited SetParent(AParent);
|
inherited SetParent(AParent);
|
||||||
|
|
||||||
// add to side list of new parent
|
if not DeletingSplitter then begin
|
||||||
ASplitter:=Splitter;
|
// add to side list of new parent
|
||||||
if ASplitter <> nil then
|
ASplitter:=Splitter;
|
||||||
ASplitter.AddSide(Self);
|
if ASplitter <> nil then
|
||||||
|
ASplitter.AddSide(Self);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPairSplitterSide.WMPaint(var PaintMessage: TLMPaint);
|
procedure TPairSplitterSide.WMPaint(var PaintMessage: TLMPaint);
|
||||||
@ -281,7 +288,7 @@ begin
|
|||||||
i := Low(FSides);
|
i := Low(FSides);
|
||||||
repeat
|
repeat
|
||||||
if FSides[i] = ASide then
|
if FSides[i] = ASide then
|
||||||
Exit;
|
Exit;
|
||||||
if FSides[i] =nil then
|
if FSides[i] =nil then
|
||||||
begin
|
begin
|
||||||
FSides[i] := ASide;
|
FSides[i] := ASide;
|
||||||
@ -309,7 +316,8 @@ begin
|
|||||||
FSides[i] := nil;
|
FSides[i] := nil;
|
||||||
end;
|
end;
|
||||||
// if the user deletes a side at designtime, autocreate a new one
|
// if the user deletes a side at designtime, autocreate a new one
|
||||||
if (csDesigning in ComponentState) then
|
if (ComponentState * [csDesigning,csDestroying] = [csDesigning])
|
||||||
|
and not DesignerDeleting then
|
||||||
CreateSides;
|
CreateSides;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user