You've already forked lazarus-ccr
RxFPC:RxDBGrid - cleanup code
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5866 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -3,7 +3,7 @@
|
||||
<ProjectSession>
|
||||
<Version Value="10"/>
|
||||
<BuildModes Active="Default"/>
|
||||
<Units Count="10">
|
||||
<Units Count="12">
|
||||
<Unit0>
|
||||
<Filename Value="WordWrapDemo.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
@ -11,7 +11,7 @@
|
||||
<WindowIndex Value="-1"/>
|
||||
<TopLine Value="-1"/>
|
||||
<CursorPos X="-1" Y="-1"/>
|
||||
<UsageCount Value="26"/>
|
||||
<UsageCount Value="31"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="unit1.pas"/>
|
||||
@ -20,49 +20,51 @@
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="Unit1"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<CursorPos X="32" Y="8"/>
|
||||
<UsageCount Value="26"/>
|
||||
<TopLine Value="57"/>
|
||||
<CursorPos X="3" Y="63"/>
|
||||
<UsageCount Value="31"/>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
</Unit1>
|
||||
<Unit2>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<TopLine Value="851"/>
|
||||
<CursorPos Y="867"/>
|
||||
<UsageCount Value="13"/>
|
||||
<Bookmarks Count="3">
|
||||
<Item0 Y="4704" ID="2"/>
|
||||
<Item1 X="7" Y="4755" ID="3"/>
|
||||
<Item2 Y="3389" ID="1"/>
|
||||
<TopLine Value="1174"/>
|
||||
<CursorPos X="42" Y="1187"/>
|
||||
<UsageCount Value="16"/>
|
||||
<Bookmarks Count="4">
|
||||
<Item0 X="7" Y="4721" ID="3"/>
|
||||
<Item1 Y="616" ID="4"/>
|
||||
<Item2 X="3" Y="4998" ID="1"/>
|
||||
<Item3 X="49" Y="362" ID="2"/>
|
||||
</Bookmarks>
|
||||
<Loaded Value="True"/>
|
||||
</Unit2>
|
||||
<Unit3>
|
||||
<Filename Value="../../../../../lcl/dbgrids.pas"/>
|
||||
<UnitName Value="DBGrids"/>
|
||||
<EditorIndex Value="3"/>
|
||||
<EditorIndex Value="5"/>
|
||||
<TopLine Value="2880"/>
|
||||
<CursorPos Y="2901"/>
|
||||
<UsageCount Value="13"/>
|
||||
<UsageCount Value="16"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit3>
|
||||
<Unit4>
|
||||
<Filename Value="../../../../../lcl/grids.pas"/>
|
||||
<UnitName Value="Grids"/>
|
||||
<EditorIndex Value="4"/>
|
||||
<EditorIndex Value="6"/>
|
||||
<TopLine Value="2482"/>
|
||||
<CursorPos X="3" Y="2484"/>
|
||||
<UsageCount Value="13"/>
|
||||
<UsageCount Value="16"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit4>
|
||||
<Unit5>
|
||||
<Filename Value="/home/install/source/fpcsrc/packages/fcl-db/src/base/db.pas"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<EditorIndex Value="4"/>
|
||||
<TopLine Value="1560"/>
|
||||
<CursorPos X="15" Y="1578"/>
|
||||
<UsageCount Value="13"/>
|
||||
<UsageCount Value="16"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit5>
|
||||
<Unit6>
|
||||
@ -70,163 +72,170 @@
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="199"/>
|
||||
<CursorPos X="3" Y="202"/>
|
||||
<UsageCount Value="9"/>
|
||||
<UsageCount Value="8"/>
|
||||
</Unit6>
|
||||
<Unit7>
|
||||
<Filename Value="/home/install/source/fpcsrc/packages/fcl-db/src/base/dataset.inc"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="1284"/>
|
||||
<CursorPos X="3" Y="1287"/>
|
||||
<UsageCount Value="9"/>
|
||||
<UsageCount Value="8"/>
|
||||
</Unit7>
|
||||
<Unit8>
|
||||
<Filename Value="../../../../../lcl/include/wincontrol.inc"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="5739"/>
|
||||
<CursorPos Y="5757"/>
|
||||
<UsageCount Value="9"/>
|
||||
<UsageCount Value="8"/>
|
||||
</Unit8>
|
||||
<Unit9>
|
||||
<Filename Value="../../../../../lcl/include/winapi.inc"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="929"/>
|
||||
<CursorPos Y="949"/>
|
||||
<UsageCount Value="9"/>
|
||||
<UsageCount Value="8"/>
|
||||
</Unit9>
|
||||
<Unit10>
|
||||
<Filename Value="/home/install/source/fpcsrc/rtl/objpas/classes/classesh.inc"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<TopLine Value="518"/>
|
||||
<CursorPos X="14" Y="537"/>
|
||||
<UsageCount Value="10"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit10>
|
||||
<Unit11>
|
||||
<Filename Value="/home/install/source/fpcsrc/rtl/objpas/classes/collect.inc"/>
|
||||
<EditorIndex Value="3"/>
|
||||
<TopLine Value="289"/>
|
||||
<CursorPos X="3" Y="291"/>
|
||||
<UsageCount Value="10"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit11>
|
||||
</Units>
|
||||
<JumpHistory Count="30" HistoryIndex="29">
|
||||
<Position1>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="4760" TopLine="4731"/>
|
||||
<Caret Line="503" Column="9" TopLine="484"/>
|
||||
</Position1>
|
||||
<Position2>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="4739" TopLine="4731"/>
|
||||
<Caret Line="1174" Column="17" TopLine="1171"/>
|
||||
</Position2>
|
||||
<Position3>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="4743" Column="8" TopLine="4731"/>
|
||||
<Caret Line="6448" Column="54" TopLine="6435"/>
|
||||
</Position3>
|
||||
<Position4>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="4944" Column="12" TopLine="4913"/>
|
||||
<Caret Line="5032" Column="9" TopLine="5000"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="700" Column="15" TopLine="683"/>
|
||||
<Caret Line="4943" Column="17" TopLine="4928"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="2768" Column="3" TopLine="2757"/>
|
||||
<Caret Line="5053" Column="3" TopLine="5021"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="2861" Column="9" TopLine="2861"/>
|
||||
<Caret Line="5058" TopLine="5024"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="824" Column="15" TopLine="791"/>
|
||||
<Caret Line="5051" Column="35" TopLine="5041"/>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="5142" Column="57" TopLine="5125"/>
|
||||
<Caret Line="796" Column="15" TopLine="780"/>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="854" Column="90" TopLine="838"/>
|
||||
<Caret Line="362" Column="49" TopLine="342"/>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="853" Column="51" TopLine="840"/>
|
||||
<Caret Line="589" TopLine="570"/>
|
||||
</Position11>
|
||||
<Position12>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="75" Column="25" TopLine="55"/>
|
||||
<Caret Line="362" Column="49" TopLine="343"/>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="854" Column="96" TopLine="834"/>
|
||||
<Caret Line="5042" Column="33" TopLine="5037"/>
|
||||
</Position13>
|
||||
<Position14>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="30" Column="80" TopLine="13"/>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="5116" Column="40" TopLine="5038"/>
|
||||
</Position14>
|
||||
<Position15>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="45" TopLine="24"/>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="515" Column="48" TopLine="490"/>
|
||||
</Position15>
|
||||
<Position16>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="818" TopLine="800"/>
|
||||
<Caret Line="522" Column="21" TopLine="496"/>
|
||||
</Position16>
|
||||
<Position17>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="3391" Column="3" TopLine="3363"/>
|
||||
<Caret Line="525" Column="76" TopLine="493"/>
|
||||
</Position17>
|
||||
<Position18>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="30" Column="37" TopLine="28"/>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="1173" TopLine="1168"/>
|
||||
</Position18>
|
||||
<Position19>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="83" Column="3" TopLine="62"/>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="474" Column="49" TopLine="448"/>
|
||||
</Position19>
|
||||
<Position20>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="84" Column="30" TopLine="59"/>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="2057" Column="3" TopLine="2055"/>
|
||||
</Position20>
|
||||
<Position21>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="83" Column="42" TopLine="34"/>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="535" Column="56" TopLine="509"/>
|
||||
</Position21>
|
||||
<Position22>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="30" Column="38" TopLine="23"/>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="1176" Column="3" TopLine="1173"/>
|
||||
</Position22>
|
||||
<Position23>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="90" Column="3" TopLine="70"/>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="471" Column="15" TopLine="466"/>
|
||||
</Position23>
|
||||
<Position24>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="62" Column="3" TopLine="50"/>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="2063" TopLine="2060"/>
|
||||
</Position24>
|
||||
<Position25>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="31" Column="15" TopLine="8"/>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="535" Column="65" TopLine="470"/>
|
||||
</Position25>
|
||||
<Position26>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="90" TopLine="68"/>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="530" Column="58" TopLine="528"/>
|
||||
</Position26>
|
||||
<Position27>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="27" Column="15" TopLine="12"/>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="1176" Column="3" TopLine="1174"/>
|
||||
</Position27>
|
||||
<Position28>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="64" TopLine="59"/>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="471" Column="14" TopLine="453"/>
|
||||
</Position28>
|
||||
<Position29>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="31" Column="15" TopLine="8"/>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="2069" TopLine="2066"/>
|
||||
</Position29>
|
||||
<Position30>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="89" TopLine="64"/>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="530" Column="14" TopLine="499"/>
|
||||
</Position30>
|
||||
</JumpHistory>
|
||||
</ProjectSession>
|
||||
<Debugging>
|
||||
<BreakPoints Count="1">
|
||||
<Item1>
|
||||
<Kind Value="bpkSource"/>
|
||||
<WatchScope Value="wpsLocal"/>
|
||||
<WatchKind Value="wpkWrite"/>
|
||||
<Source Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Line Value="5708"/>
|
||||
</Item1>
|
||||
</BreakPoints>
|
||||
<Watches Count="2">
|
||||
<Item1>
|
||||
<Expression Value="H1"/>
|
||||
|
@ -54,6 +54,7 @@ type
|
||||
TRxColumn = class;
|
||||
TRxDBGridAbstractTools = class;
|
||||
TRxDbGridColumnsEnumerator = class;
|
||||
TRxColumnFooterItemsEnumerator = class;
|
||||
|
||||
|
||||
TRxQuickSearchNotifyEvent = procedure(Sender: TObject; Field: TField;
|
||||
@ -358,10 +359,25 @@ type
|
||||
procedure Update(Item: TCollectionItem); override;
|
||||
public
|
||||
constructor Create(AOwner: TPersistent);
|
||||
function GetEnumerator: TRxColumnFooterItemsEnumerator;
|
||||
public
|
||||
property Items[Index: integer]: TRxColumnFooterItem read GetItem write SetItem; default;
|
||||
end;
|
||||
|
||||
{ TRxColumnFooterItemsEnumerator }
|
||||
|
||||
TRxColumnFooterItemsEnumerator = class
|
||||
private
|
||||
FList: TRxColumnFooterItems;
|
||||
FPosition: Integer;
|
||||
public
|
||||
constructor Create(AList: TRxColumnFooterItems);
|
||||
function GetCurrent: TRxColumnFooterItem;
|
||||
function MoveNext: Boolean;
|
||||
property Current: TRxColumnFooterItem read GetCurrent;
|
||||
end;
|
||||
|
||||
|
||||
{ TRxColumnFilter }
|
||||
|
||||
TRxFilterState = (rxfsAll, rxfsEmpty, rxfsNonEmpty, rxfsFilter{, rxfsTopXXXX});
|
||||
@ -463,6 +479,64 @@ type
|
||||
property Items[Index: integer]: TRxColumnEditButton read GetItem write SetItem; default;
|
||||
end;
|
||||
|
||||
TColumnGroupItemValue = class
|
||||
FieldName:string;
|
||||
GroupValue:Double;
|
||||
end;
|
||||
|
||||
{ TColumnGroupItem }
|
||||
|
||||
TColumnGroupItem = class
|
||||
RecordNo:integer;
|
||||
FieldValue:string;
|
||||
RecordCount:integer;
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
end;
|
||||
|
||||
{ TColumnGroupItems }
|
||||
|
||||
TColumnGroupItems = class
|
||||
private
|
||||
FActive: boolean;
|
||||
procedure SetActive(AValue: boolean);
|
||||
public
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
function FindGroup(ARecordNo:integer):TColumnGroupItem;
|
||||
procedure Clear;
|
||||
procedure UpdateValues;
|
||||
published
|
||||
property Active:boolean read FActive write SetActive;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
{ TRxColumnGroupParam }
|
||||
|
||||
TRxColumnGroupParam = class(TCollectionItem)
|
||||
private
|
||||
FFileName: string;
|
||||
FValueType: TFooterValueType;
|
||||
published
|
||||
property FileName:string read FFileName write FFileName;
|
||||
property ValueType:TFooterValueType read FValueType write FValueType;
|
||||
end;
|
||||
|
||||
{ TRxColumnGroupParams }
|
||||
|
||||
TRxColumnGroupParams = class(TOwnedCollection)
|
||||
private
|
||||
function GetItem(Index: integer): TRxColumnGroupParam;
|
||||
procedure SetItem(Index: integer; AValue: TRxColumnGroupParam);
|
||||
protected
|
||||
public
|
||||
function Add: TRxColumnGroupParam;
|
||||
public
|
||||
property Items[Index: integer]: TRxColumnGroupParam read GetItem write SetItem; default;
|
||||
end;
|
||||
|
||||
|
||||
{ TRxColumn }
|
||||
|
||||
TRxColumn = class(TColumn)
|
||||
@ -482,6 +556,8 @@ type
|
||||
FSortPosition: integer;
|
||||
FWordWrap: boolean;
|
||||
FFooters: TRxColumnFooterItems;
|
||||
//Group support
|
||||
FGroupItems:TColumnGroupItems;
|
||||
function GetConstraints: TRxDBGridCollumnConstraints;
|
||||
function GetFooter: TRxColumnFooterItem;
|
||||
function GetFooters: TRxColumnFooterItems;
|
||||
@ -1093,6 +1169,89 @@ type
|
||||
procedure EditingDone; override;
|
||||
end;
|
||||
|
||||
{ TRxColumnGroupParams }
|
||||
|
||||
function TRxColumnGroupParams.GetItem(Index: integer): TRxColumnGroupParam;
|
||||
begin
|
||||
Result:= TRxColumnGroupParam(inherited Items[Index]);
|
||||
end;
|
||||
|
||||
procedure TRxColumnGroupParams.SetItem(Index: integer;
|
||||
AValue: TRxColumnGroupParam);
|
||||
begin
|
||||
inherited SetItem(Index, AValue);
|
||||
end;
|
||||
|
||||
function TRxColumnGroupParams.Add: TRxColumnGroupParam;
|
||||
begin
|
||||
Result:=TRxColumnGroupParam.Create(Self);
|
||||
end;
|
||||
|
||||
{ TRxColumnFooterItemsEnumerator }
|
||||
|
||||
constructor TRxColumnFooterItemsEnumerator.Create(AList: TRxColumnFooterItems);
|
||||
begin
|
||||
FList := AList;
|
||||
FPosition := -1;
|
||||
end;
|
||||
|
||||
function TRxColumnFooterItemsEnumerator.GetCurrent: TRxColumnFooterItem;
|
||||
begin
|
||||
Result := FList[FPosition];
|
||||
end;
|
||||
|
||||
function TRxColumnFooterItemsEnumerator.MoveNext: Boolean;
|
||||
begin
|
||||
Inc(FPosition);
|
||||
Result := FPosition < FList.Count;
|
||||
end;
|
||||
|
||||
{ TColumnGroupItems }
|
||||
|
||||
procedure TColumnGroupItems.SetActive(AValue: boolean);
|
||||
begin
|
||||
if FActive=AValue then Exit;
|
||||
FActive:=AValue;
|
||||
end;
|
||||
|
||||
constructor TColumnGroupItems.Create;
|
||||
begin
|
||||
inherited Create;
|
||||
FActive:=false;
|
||||
end;
|
||||
|
||||
destructor TColumnGroupItems.Destroy;
|
||||
begin
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
function TColumnGroupItems.FindGroup(ARecordNo: integer): TColumnGroupItem;
|
||||
begin
|
||||
Result:=nil;
|
||||
end;
|
||||
|
||||
procedure TColumnGroupItems.Clear;
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
procedure TColumnGroupItems.UpdateValues;
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
{ TColumnGroupItem }
|
||||
|
||||
constructor TColumnGroupItem.Create;
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
destructor TColumnGroupItem.Destroy;
|
||||
begin
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
{ TRxDbGridColumnsEnumerator }
|
||||
|
||||
constructor TRxDbGridColumnsEnumerator.Create(AList: TRxDbGridColumns);
|
||||
@ -1615,6 +1774,11 @@ begin
|
||||
inherited Create(AOwner, TRxColumnFooterItem);
|
||||
end;
|
||||
|
||||
function TRxColumnFooterItems.GetEnumerator: TRxColumnFooterItemsEnumerator;
|
||||
begin
|
||||
Result:=TRxColumnFooterItemsEnumerator.Create(Self);
|
||||
end;
|
||||
|
||||
{ TRxDBGridAbstractTools }
|
||||
|
||||
procedure TRxDBGridAbstractTools.SetRxDBGrid(AValue: TRxDBGrid);
|
||||
@ -4824,60 +4988,54 @@ var
|
||||
|
||||
SaveAfterScroll:TDataSetNotifyEvent;
|
||||
SaveBeforeScroll:TDataSetNotifyEvent;
|
||||
RCol:TRxColumn;
|
||||
C:TRxColumn;
|
||||
AValue:Variant;
|
||||
|
||||
FCList:TFPList;
|
||||
FCList, FCList2:TFPList;
|
||||
j: Integer;
|
||||
F: TRxColumnFooterItem;
|
||||
begin
|
||||
if (not (FFooterOptions.Active and DatalinkActive)) or (Columns.Count = 0) or (gsAddingAutoColumns in GridStatus) then
|
||||
Exit;
|
||||
//Дополнительно проверим - а стоит ли делать пробег по данным - есть ли агрегатные функции
|
||||
|
||||
if Assigned(OnRxCalcFooterValues)then
|
||||
begin
|
||||
Inc(FInProcessCalc);
|
||||
for i := 0 to Columns.Count - 1 do
|
||||
for C in Columns do
|
||||
begin
|
||||
RCol := TRxColumn(Columns[i]);
|
||||
RCol.Footer.ResetTestValue;
|
||||
C.Footer.ResetTestValue;
|
||||
AValue:=Null;
|
||||
OnRxCalcFooterValues(Self, RCol, AValue);
|
||||
if AValue<>null then RCol.Footer.FTestValue := AValue;
|
||||
OnRxCalcFooterValues(Self, C, AValue);
|
||||
if AValue<>null then C.Footer.FTestValue := AValue;
|
||||
end;
|
||||
Dec(FInProcessCalc);
|
||||
Exit;
|
||||
end;
|
||||
|
||||
APresent := False;
|
||||
for i := 0 to Columns.Count - 1 do
|
||||
for C in Columns do
|
||||
begin
|
||||
APresent := TRxColumn(Columns[i]).Footer.FValueType in
|
||||
[fvtSum, fvtAvg, fvtMax, fvtMin, fvtCount];
|
||||
|
||||
APresent := (C.Footer.FValueType in [fvtSum, fvtAvg, fvtMax, fvtMin, fvtCount]) or (C.FGroupItems.Active);
|
||||
if not APresent then
|
||||
for j:=0 to TRxColumn(Columns[i]).Footers.Count-1 do
|
||||
for F in C.Footers do
|
||||
begin
|
||||
APresent:=TRxColumn(Columns[i]).Footers[j].FValueType in [fvtSum, fvtAvg, fvtMax, fvtMin, fvtCount];
|
||||
APresent:=F.FValueType in [fvtSum, fvtAvg, fvtMax, fvtMin, fvtCount];
|
||||
if APresent then
|
||||
break;
|
||||
end;
|
||||
|
||||
if APresent then
|
||||
break;
|
||||
end;
|
||||
|
||||
if not APresent then
|
||||
exit;
|
||||
if not APresent then Exit;
|
||||
|
||||
|
||||
Inc(FInProcessCalc);
|
||||
|
||||
cnt:=0;
|
||||
for i := 0 to Columns.Count - 1 do
|
||||
for C in Columns do
|
||||
begin
|
||||
TRxColumn(Columns[i]).Footer.ResetTestValue;
|
||||
for j:=0 to TRxColumn(Columns[i]).Footers.Count - 1 do
|
||||
TRxColumn(Columns[i]).Footers[j].ResetTestValue;
|
||||
C.Footer.ResetTestValue;
|
||||
for F in C.Footers do F.ResetTestValue;
|
||||
C.FGroupItems.Clear;
|
||||
end;
|
||||
|
||||
if (DataSource.DataSet.RecordCount<=0) then
|
||||
@ -4906,24 +5064,27 @@ begin
|
||||
SavePos:=DHS.RecNo;
|
||||
|
||||
FCList:=TFPList.Create;
|
||||
for i:=0 to Columns.Count-1 do
|
||||
FCList2:=TFPList.Create;
|
||||
|
||||
for C in Columns do
|
||||
begin
|
||||
RCol:=TRxColumn(Columns[i]);
|
||||
if (RCol.Footer.ValueType in [fvtSum, fvtAvg, fvtMax, fvtMin]) and RCol.Visible then
|
||||
if (C.Footer.ValueType in [fvtSum, fvtAvg, fvtMax, fvtMin]) and C.Visible then
|
||||
begin
|
||||
FCList.Add(RCol);
|
||||
RCol.Footer.FField:=DHS.FieldByName(RCol.Footer.FieldName);
|
||||
FCList.Add(C);
|
||||
C.Footer.FField:=DHS.FieldByName(C.Footer.FieldName);
|
||||
end;
|
||||
|
||||
for j:=0 to RCol.Footers.Count - 1 do
|
||||
for F in C.Footers do
|
||||
begin
|
||||
if (RCol.Footers[j].ValueType in [fvtSum, fvtAvg, fvtMax, fvtMin]) and RCol.Visible then
|
||||
if (F.ValueType in [fvtSum, fvtAvg, fvtMax, fvtMin]) and C.Visible then
|
||||
begin
|
||||
if FCList.IndexOf(RCol) < 0 then
|
||||
FCList.Add(RCol);
|
||||
RCol.Footers[j].FField:=DHS.FieldByName(RCol.Footers[j].FieldName);
|
||||
if FCList.IndexOf(C) < 0 then
|
||||
FCList.Add(C);
|
||||
F.FField:=DHS.FieldByName(F.FieldName);
|
||||
end;
|
||||
end;
|
||||
|
||||
if C.FGroupItems.Active then FCList2.Add(C);
|
||||
end;
|
||||
|
||||
DHS.First;
|
||||
@ -4931,38 +5092,42 @@ begin
|
||||
begin
|
||||
for i:=0 to FCList.Count-1 do
|
||||
begin
|
||||
RCol:=TRxColumn(FCList[i]);
|
||||
if (RCol.FFooter.FValueType in [fvtSum, fvtAvg, fvtMax, fvtMin]) and Assigned(RCol.FFooter.FField) then
|
||||
RCol.FFooter.UpdateTestValueFromVar( RCol.FFooter.FField.AsVariant);
|
||||
C:=TRxColumn(FCList[i]);
|
||||
if (C.FFooter.FValueType in [fvtSum, fvtAvg, fvtMax, fvtMin]) and Assigned(C.FFooter.FField) then
|
||||
C.FFooter.UpdateTestValueFromVar(C.FFooter.FField.AsVariant);
|
||||
|
||||
for j:=0 to RCol.FFooters.Count-1 do
|
||||
for F in C.FFooters do
|
||||
begin
|
||||
if (RCol.FFooters[j].FValueType in [fvtSum, fvtAvg, fvtMax, fvtMin]) and Assigned(RCol.FFooters[j].FField) then
|
||||
RCol.FFooters[j].UpdateTestValueFromVar( RCol.FFooters[j].FField.AsVariant)
|
||||
if (F.FValueType in [fvtSum, fvtAvg, fvtMax, fvtMin]) and Assigned(F.FField) then
|
||||
F.UpdateTestValueFromVar( F.FField.AsVariant)
|
||||
end;
|
||||
end;
|
||||
|
||||
for i:=0 to FCList2.Count-1 do
|
||||
TRxColumn(FCList[i]).FGroupItems.UpdateValues;
|
||||
|
||||
inc(cnt);
|
||||
DHS.Next;
|
||||
end;
|
||||
|
||||
FCList2.Free;
|
||||
FCList.Free;
|
||||
|
||||
for i:=0 to Columns.Count-1 do
|
||||
for C in Columns do
|
||||
begin
|
||||
RCol:=TRxColumn(Columns[i]);
|
||||
if RCol.Footer.ValueType = fvtCount then
|
||||
RCol.FFooter.FCountRec:=Cnt
|
||||
if C.Footer.ValueType = fvtCount then
|
||||
C.FFooter.FCountRec:=Cnt
|
||||
else
|
||||
if RCol.Footer.ValueType = fvtAvg then
|
||||
RCol.FFooter.FTestValue:=RCol.FFooter.FTestValue / Cnt;
|
||||
if C.Footer.ValueType = fvtAvg then
|
||||
C.FFooter.FTestValue:=C.FFooter.FTestValue / Cnt;
|
||||
|
||||
for j:=0 to RCol.Footers.Count-1 do
|
||||
for F in C.Footers do
|
||||
begin
|
||||
if RCol.Footers[j].ValueType = fvtCount then
|
||||
RCol.FFooters[j].FCountRec:=Cnt
|
||||
if F.ValueType = fvtCount then
|
||||
F.FCountRec:=Cnt
|
||||
else
|
||||
if RCol.Footers[j].ValueType = fvtAvg then
|
||||
RCol.FFooters[j].FTestValue:=RCol.FFooter.FTestValue / Cnt;
|
||||
if F.ValueType = fvtAvg then
|
||||
F.FTestValue:=F.FTestValue / Cnt;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -5953,10 +6118,12 @@ begin
|
||||
FEditButtons:=TRxColumnEditButtons.Create(Self);
|
||||
FOptions:=[coCustomizeVisible, coCustomizeWidth];
|
||||
FFooters:=TRxColumnFooterItems.Create(Self);
|
||||
FGroupItems:=TColumnGroupItems.Create;
|
||||
end;
|
||||
|
||||
destructor TRxColumn.Destroy;
|
||||
begin
|
||||
FreeAndNil(FGroupItems);
|
||||
FreeAndNil(FFooters);
|
||||
FreeAndNil(FEditButtons);
|
||||
if FKeyList <> nil then
|
||||
|
Reference in New Issue
Block a user