PowerPDF, check panel dimension only if handle is allocated

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1146 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
jesusr
2010-01-27 17:37:28 +00:00
parent d6a4c12f64
commit 79dfe275b2

View File

@@ -1342,15 +1342,28 @@ end;
procedure TPRGridPanel.SetColCount(Value: integer);
var
Rect: TRect;
procedure raiseex;
begin
raise Exception.Create('invalid colcount');
end;
begin
if Value <> FColCount then
begin
if (Value < 1) or ((Width div Value) < MIN_PANEL_SIZE) then
raise Exception.Create('invalid colcount');
if (Value < 1) then
raiseex;
FColCount := Value;
Rect := GetClientRect;
AlignControls(nil, Rect);
Invalidate;
if HandleAllocated then begin
if ((Width div Value) < MIN_PANEL_SIZE) then
raiseex;
Rect := GetClientRect;
AlignControls(nil, Rect);
Invalidate;
end;
end;
end;
@@ -1358,15 +1371,29 @@ end;
procedure TPRGridPanel.SetRowCount(Value: integer);
var
Rect: TRect;
procedure raiseex;
begin
raise Exception.CreateFmt('invalid rowcount=%d',[Value]);
end;
begin
if Value <> FRowCount then
begin
if (Value < 1) or ((Height div Value) < MIN_PANEL_SIZE) then
raise Exception.Create('invalid rowcount');
if (Value < 1) then
raiseex;
FRowCount := Value;
Rect := GetClientRect;
AlignControls(nil, Rect);
Invalidate;
if handleallocated then begin
if ((Height div Value) < MIN_PANEL_SIZE) then
raiseex;
Rect := GetClientRect;
AlignControls(nil, Rect);
Invalidate;
end;
end;
end;