lcl: review some exception raising code

git-svn-id: trunk@26662 -
This commit is contained in:
paul 2010-07-15 11:30:21 +00:00
parent 8851d2a322
commit 262184b138
3 changed files with 11 additions and 22 deletions

View File

@ -3428,7 +3428,7 @@ var
procedure RaiseInvalidSide; procedure RaiseInvalidSide;
begin begin
raise Exception.Create('TAnchorSide.GetSidePosition invalid Side'); raise Exception.Create('TAnchorSide.CheckSidePosition invalid Side');
end; end;
function GetNextCentered(ReferenceControl: TControl; Side: TAnchorKind; function GetNextCentered(ReferenceControl: TControl; Side: TAnchorKind;

View File

@ -342,7 +342,7 @@ end;
procedure TDockZone.Remove(ChildZone: TDockZone); procedure TDockZone.Remove(ChildZone: TDockZone);
begin begin
if ChildZone.Parent<>Self then if ChildZone.Parent <> Self then
raise Exception.Create('TDockZone.Remove'); raise Exception.Create('TDockZone.Remove');
if ChildZone=FFirstChildZone then FFirstChildZone:=ChildZone.FNextSibling; if ChildZone=FFirstChildZone then FFirstChildZone:=ChildZone.FNextSibling;
if ChildZone.FNextSibling<>nil then if ChildZone.FNextSibling<>nil then

View File

@ -7513,19 +7513,12 @@ end;
decreases the BoundsLockCount decreases the BoundsLockCount
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
procedure TWinControl.EndUpdateBounds; procedure TWinControl.EndUpdateBounds;
procedure RaiseTooManyEndUpdates;
begin
raise Exception.Create('TWinControl.EndUpdateBounds '+DbgSName(Self)
+' too many calls.');
end;
begin begin
if FBoundsLockCount<=0 then RaiseTooManyEndUpdates; if FBoundsLockCount <= 0 then
raise EInvalidOperation.CreateFmt('TWinControl.EndUpdateBounds %s too many calls.', [DbgSName(Self)]);
dec(FBoundsLockCount); dec(FBoundsLockCount);
if FBoundsLockCount=0 then begin if FBoundsLockCount = 0 then
SetBounds(Left,Top,Width,Height); SetBounds(Left, Top, Width, Height);
end;
end; end;
procedure TWinControl.LockRealizeBounds; procedure TWinControl.LockRealizeBounds;
@ -7667,16 +7660,12 @@ procedure TWinControl.SetBounds(ALeft, ATop, AWidth, AHeight: integer);
procedure CheckDesignBounds; procedure CheckDesignBounds;
begin begin
if FRealizeBoundsLockCount>0 then exit; if FRealizeBoundsLockCount > 0 then Exit;
// the user changed the bounds // the user changed the bounds
if aWidth<0 then if AWidth < 0 then
raise Exception.Create( raise EInvalidOperation.CreateFmt('TWinControl.SetBounds (%s): Negative width %d not allowed.', [DbgSName(Self), AWidth]);
'TWinControl.SetBounds ('+DbgSName(Self)+'): Negative width ' if AHeight < 0 then
+dbgs(aWidth)+' not allowed.'); raise EInvalidOperation.CreateFmt('TWinControl.SetBounds (%s): Negative height %d not allowed.', [DbgSName(Self), AHeight]);
if aHeight<0 then
raise Exception.Create(
'TWinControl.SetBounds ('+DbgSName(Self)+'): Negative height '
+dbgs(aHeight)+' not allowed.');
end; end;
var var