You've already forked lazarus-ccr
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:
@@ -1342,32 +1342,59 @@ end;
|
|||||||
procedure TPRGridPanel.SetColCount(Value: integer);
|
procedure TPRGridPanel.SetColCount(Value: integer);
|
||||||
var
|
var
|
||||||
Rect: TRect;
|
Rect: TRect;
|
||||||
|
|
||||||
|
procedure raiseex;
|
||||||
|
begin
|
||||||
|
raise Exception.Create('invalid colcount');
|
||||||
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if Value <> FColCount then
|
if Value <> FColCount then
|
||||||
begin
|
begin
|
||||||
if (Value < 1) or ((Width div Value) < MIN_PANEL_SIZE) then
|
if (Value < 1) then
|
||||||
raise Exception.Create('invalid colcount');
|
raiseex;
|
||||||
|
|
||||||
FColCount := Value;
|
FColCount := Value;
|
||||||
|
|
||||||
|
if HandleAllocated then begin
|
||||||
|
if ((Width div Value) < MIN_PANEL_SIZE) then
|
||||||
|
raiseex;
|
||||||
|
|
||||||
Rect := GetClientRect;
|
Rect := GetClientRect;
|
||||||
AlignControls(nil, Rect);
|
AlignControls(nil, Rect);
|
||||||
Invalidate;
|
Invalidate;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
// SetRowCount
|
// SetRowCount
|
||||||
procedure TPRGridPanel.SetRowCount(Value: integer);
|
procedure TPRGridPanel.SetRowCount(Value: integer);
|
||||||
var
|
var
|
||||||
Rect: TRect;
|
Rect: TRect;
|
||||||
|
|
||||||
|
procedure raiseex;
|
||||||
|
begin
|
||||||
|
raise Exception.CreateFmt('invalid rowcount=%d',[Value]);
|
||||||
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if Value <> FRowCount then
|
if Value <> FRowCount then
|
||||||
begin
|
begin
|
||||||
if (Value < 1) or ((Height div Value) < MIN_PANEL_SIZE) then
|
if (Value < 1) then
|
||||||
raise Exception.Create('invalid rowcount');
|
raiseex;
|
||||||
|
|
||||||
FRowCount := Value;
|
FRowCount := Value;
|
||||||
|
|
||||||
|
if handleallocated then begin
|
||||||
|
if ((Height div Value) < MIN_PANEL_SIZE) then
|
||||||
|
raiseex;
|
||||||
|
|
||||||
Rect := GetClientRect;
|
Rect := GetClientRect;
|
||||||
AlignControls(nil, Rect);
|
AlignControls(nil, Rect);
|
||||||
Invalidate;
|
Invalidate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// Paint
|
// Paint
|
||||||
|
Reference in New Issue
Block a user