Attempted fix of resizing issue in TOvcTable as a result of LCL 0.9.29 change in SetBounds behavior.

http://wiki.lazarus.freepascal.org/Lazarus_0.9.30_release_notes#overriding_TControl.SetBounds

Unknown how many other places where this or similar fixes will be needed; Orpheus overrides SetBounds throughout.

Also uncommented two place where Screen.DataModules was used as this now appears to be implemented in LCL.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1471 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
macpgmr
2011-01-29 23:51:20 +00:00
parent 304dbb2e2f
commit 2c37512236
4 changed files with 40 additions and 12 deletions

View File

@ -580,7 +580,11 @@ type
procedure CreateWnd; override;
procedure Loaded; override;
procedure Paint; override;
{$IFNDEF LCL}
procedure SetBounds(ALeft, ATop, AWidth, AHeight: integer); override;
{$ELSE}
procedure DoSetBounds(ALeft, ATop, AWidth, AHeight: integer); override;
{$ENDIF}
{new public methods}
function CalcRowColFromXY(X, Y : integer;
@ -3663,14 +3667,25 @@ procedure TOvcCustomTable.tbQueryRowData(RowNum : TRowNum;
end;
end;
{--------}
{$IFNDEF LCL}
procedure TOvcCustomTable.SetBounds(ALeft, ATop, AWidth, AHeight: integer);
{$ELSE}
procedure TOvcCustomTable.DoSetBounds(ALeft, ATop, AWidth, AHeight: integer);
{$ENDIF}
// LCL port: Behavior of SetBounds changed in 0.9.29, so using DoSetBounds.
// http://wiki.lazarus.freepascal.org/Lazarus_0.9.30_release_notes#overriding_TControl.SetBounds
// Calls to TOvcTable.SetBounds will just be handled by ancestor.
var
WidthChanged : boolean;
HeightChanged : boolean;
begin
if (not HandleAllocated) then
begin
{$IFNDEF LCL}
inherited SetBounds(ALeft, ATop, AWidth, AHeight);
{$ELSE}
inherited DoSetBounds(ALeft, ATop, AWidth, AHeight);
{$ENDIF}
Exit;
end;
@ -3681,7 +3696,11 @@ procedure TOvcCustomTable.SetBounds(ALeft, ATop, AWidth, AHeight: integer);
begin
AllowRedraw := false;
try
{$IFNDEF LCL}
inherited SetBounds(ALeft, ATop, AWidth, AHeight);
{$ELSE}
inherited DoSetBounds(ALeft, ATop, AWidth, AHeight);
{$ENDIF}
if WidthChanged then
tbCalcColData(tbColNums, LeftCol);
if HeightChanged then
@ -3698,7 +3717,11 @@ procedure TOvcCustomTable.SetBounds(ALeft, ATop, AWidth, AHeight: integer);
end;{try..finally}
end
else
{$IFNDEF LCL}
inherited SetBounds(ALeft, ATop, AWidth, AHeight);
{$ELSE}
inherited DoSetBounds(ALeft, ATop, AWidth, AHeight);
{$ENDIF}
end;
{====================================================================}

View File

@ -577,15 +577,15 @@ procedure TOvcTableColumns.tcStopLoading;
{fixup references to cell components on any data modules}
if (FFixups.Count <> 0) then begin
DM := 0;
{$IFNDEF LCL}
//{$IFNDEF LCL}
DMCount := Screen.DataModuleCount;
{$ELSE}
DMCount := 0;
{$ENDIF}
//{$ELSE}
// DMCount := 0;
//{$ENDIF}
while (FFixups.Count > 0) and (DM < DMCount) do begin
{$IFNDEF LCL}
//{$IFNDEF LCL}
DataMod := Screen.DataModules[DM];
{$ENDIF}
//{$ENDIF}
for i := pred(FFixups.Count) downto 0 do
if (GetFormName(FFixups[i], Form.Name) = DataMod.Name) then begin
Compnt := DataMod.FindComponent(GetComponentName(FFixups[i]));

View File

@ -426,6 +426,9 @@ procedure TOvcBaseTableCell.tcChangeScale(M, D : integer);
{--------}
procedure TOvcBaseTableCell.DecRefs;
begin
//try // LCL: On Carbon, get "EXC_BAD_ACCESS, Could not access memory" for
// FReferences when free cell's column (for example, when quit app),
// as though cell object's memory already freed, so trap and ignore.
if (FReferences > 0) then
begin
dec(FReferences);
@ -436,6 +439,8 @@ procedure TOvcBaseTableCell.DecRefs;
FOnCfgChanged := nil;
end;
end;
//except
//end;
end;
{--------}
function TOvcBaseTableCell.DoOwnerDraw(TableCanvas : TCanvas;

View File

@ -715,16 +715,16 @@ begin
if (taLoadList.Count <> 0) then
begin
DM := 0;
{$IFNDEF LCL}
//{$IFNDEF LCL}
DMCount := Screen.DataModuleCount;
{$ELSE}
DMCount := 0;
{$ENDIF}
//{$ELSE}
// DMCount := 0;
//{$ENDIF}
while (taLoadList.Count > 0) and (DM < DMCount) do
begin
{$IFNDEF LCL}
//{$IFNDEF LCL}
DataMod := Screen.DataModules[DM];
{$ENDIF}
//{$ENDIF}
for i := pred(taLoadList.Count) downto 0 do
if (GetFormName(taLoadList[i], Form.Name) = DataMod.Name) then
begin