From b5bdb59ab46fb03221a87a7bcb0e533c4ddb6ce3 Mon Sep 17 00:00:00 2001 From: micha Date: Sun, 20 Feb 2005 20:03:07 +0000 Subject: [PATCH] horzscrollbar is nil sometimes when destroying component (fixing symptoms instead of cause?, fixes bug #607) git-svn-id: trunk@6820 - --- lcl/interfaces/win32/win32proc.pp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lcl/interfaces/win32/win32proc.pp b/lcl/interfaces/win32/win32proc.pp index a4967f2893..4dfaaf6151 100644 --- a/lcl/interfaces/win32/win32proc.pp +++ b/lcl/interfaces/win32/win32proc.pp @@ -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