horzscrollbar is nil sometimes when destroying component (fixing symptoms instead of cause?, fixes bug #607)

git-svn-id: trunk@6820 -
This commit is contained in:
micha 2005-02-20 20:03:07 +00:00
parent 14132a2414
commit b5bdb59ab4

View File

@ -773,14 +773,16 @@ Begin
TheWinControl:=TWinControl(Sender);
if not TheWinControl.HandleAllocated then exit;
Handle := TheWinControl.Handle;
ORect.Left := 0;
ORect.Top := 0;
if TheWinControl is TScrollingWinControl then
begin
ORect.Left := -TScrollingWinControl(TheWinControl).HorzScrollBar.Position;
ORect.Top := -TScrollingWinControl(TheWinControl).VertScrollBar.Position;
end else begin
ORect.Left := 0;
ORect.Top := 0;
end;
with TScrollingWinControl(TheWinControl) do
begin
if HorzScrollBar <> nil then
ORect.Left := -HorzScrollBar.Position;
if VertScrollBar <> nil then
ORect.Top := -VertScrollBar.Position;
end;
ORect.Bottom := 0;
ORect.Right := 0;
If (TheWinControl is TCustomGroupBox) Then