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); TheWinControl:=TWinControl(Sender);
if not TheWinControl.HandleAllocated then exit; if not TheWinControl.HandleAllocated then exit;
Handle := TheWinControl.Handle; Handle := TheWinControl.Handle;
ORect.Left := 0;
ORect.Top := 0;
if TheWinControl is TScrollingWinControl then if TheWinControl is TScrollingWinControl then
begin with TScrollingWinControl(TheWinControl) do
ORect.Left := -TScrollingWinControl(TheWinControl).HorzScrollBar.Position; begin
ORect.Top := -TScrollingWinControl(TheWinControl).VertScrollBar.Position; if HorzScrollBar <> nil then
end else begin ORect.Left := -HorzScrollBar.Position;
ORect.Left := 0; if VertScrollBar <> nil then
ORect.Top := 0; ORect.Top := -VertScrollBar.Position;
end; end;
ORect.Bottom := 0; ORect.Bottom := 0;
ORect.Right := 0; ORect.Right := 0;
If (TheWinControl is TCustomGroupBox) Then If (TheWinControl is TCustomGroupBox) Then