TScrollingWinControl: fixed AV during destruction

git-svn-id: trunk@9763 -
This commit is contained in:
mattias 2006-08-28 21:44:51 +00:00
parent 5c7c30f966
commit 3093718d32
2 changed files with 17 additions and 7 deletions

View File

@ -36,12 +36,19 @@ end;
function TScrollingWinControl.GetClientScrollOffset: TPoint; function TScrollingWinControl.GetClientScrollOffset: TPoint;
begin begin
Result.X:=HorzScrollBar.Position; if (HorzScrollBar<>nil) and (VertScrollBar<>nil) then begin
Result.Y:=VertScrollBar.Position; Result.X:=HorzScrollBar.Position;
Result.Y:=VertScrollBar.Position;
end else begin
Result.X:=0;
Result.Y:=0;
end;
end; end;
procedure TScrollingWinControl.AlignControls(AControl: TControl; var ARect: TRect); procedure TScrollingWinControl.AlignControls(AControl: TControl;
var ARect: TRect);
begin begin
if (HorzScrollBar=nil) or (VertScrollBar=nil) then exit;
HorzScrollBar.AutoCalcRange; HorzScrollBar.AutoCalcRange;
VertScrollBar.AutoCalcRange; VertScrollBar.AutoCalcRange;
If not AutoScroll then If not AutoScroll then
@ -117,7 +124,8 @@ end;
function TScrollingWinControl.HasVisibleScrollbars: boolean; function TScrollingWinControl.HasVisibleScrollbars: boolean;
begin begin
Result:=VertScrollBar.Visible and HorzScrollBar.Visible; Result:=(VertScrollBar<>nil) and VertScrollBar.Visible
and (HorzScrollBar<>nil) and HorzScrollBar.Visible;
end; end;
procedure TScrollingWinControl.DestroyWnd; procedure TScrollingWinControl.DestroyWnd;
@ -134,8 +142,10 @@ end;
procedure TScrollingWinControl.ScrollBy(DeltaX, DeltaY: Integer); procedure TScrollingWinControl.ScrollBy(DeltaX, DeltaY: Integer);
begin begin
TWSScrollingWinControlClass(WidgetSetClass).ScrollBy(Self, DeltaX, DeltaY); if HandleAllocated then begin
Invalidate; TWSScrollingWinControlClass(WidgetSetClass).ScrollBy(Self, DeltaX, DeltaY);
Invalidate;
end;
end; end;
Procedure TScrollingWinControl.WMVScroll(var Message : TLMVScroll); Procedure TScrollingWinControl.WMVScroll(var Message : TLMVScroll);

View File

@ -826,7 +826,7 @@ begin
NeighbourControl.Parent.DisableAlign; NeighbourControl.Parent.DisableAlign;
// TODO: create a PageControl and two pages. And move the neigbbours onto // TODO: create a PageControl and two pages. And move the neigbbours onto
// one page and Control to the other page. // one page and Control to the other page.
if AnchorControls[akLeft]=nil then ;
finally finally
NeighbourList.Free; NeighbourList.Free;