You've already forked lazarus-ccr
RxFPC:in RxDBGrid filter add code for filter null values in grid
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5134 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -44,6 +44,7 @@
|
||||
<Filename Value="unit1.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="Form1"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="Unit1"/>
|
||||
</Unit1>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<ProjectSession>
|
||||
<Version Value="9"/>
|
||||
<BuildModes Active="Default"/>
|
||||
<Units Count="2">
|
||||
<Units Count="4">
|
||||
<Unit0>
|
||||
<Filename Value="project1.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
@ -11,54 +11,162 @@
|
||||
<WindowIndex Value="-1"/>
|
||||
<TopLine Value="-1"/>
|
||||
<CursorPos X="-1" Y="-1"/>
|
||||
<UsageCount Value="20"/>
|
||||
<UsageCount Value="21"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="Form1"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="Unit1"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<TopLine Value="11"/>
|
||||
<CursorPos X="8" Y="53"/>
|
||||
<UsageCount Value="20"/>
|
||||
<CursorPos X="6" Y="21"/>
|
||||
<UsageCount Value="21"/>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
</Unit1>
|
||||
<Unit2>
|
||||
<Filename Value="../../rxdbgrid.pas"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<TopLine Value="6169"/>
|
||||
<CursorPos X="16" Y="6179"/>
|
||||
<UsageCount Value="10"/>
|
||||
<Bookmarks Count="1">
|
||||
<Item0 Y="5181" ID="1"/>
|
||||
</Bookmarks>
|
||||
<Loaded Value="True"/>
|
||||
</Unit2>
|
||||
<Unit3>
|
||||
<Filename Value="../../rxdconst.pas"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<TopLine Value="102"/>
|
||||
<CursorPos X="73" Y="118"/>
|
||||
<UsageCount Value="10"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit3>
|
||||
</Units>
|
||||
<JumpHistory Count="8" HistoryIndex="7">
|
||||
<JumpHistory Count="30" HistoryIndex="29">
|
||||
<Position1>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Filename Value="../../rxdbgrid.pas"/>
|
||||
<Caret Line="391" Column="61" TopLine="361"/>
|
||||
</Position1>
|
||||
<Position2>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="2"/>
|
||||
<Filename Value="../../rxdbgrid.pas"/>
|
||||
<Caret Line="390" Column="67" TopLine="366"/>
|
||||
</Position2>
|
||||
<Position3>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="54" Column="24" TopLine="25"/>
|
||||
<Filename Value="../../rxdbgrid.pas"/>
|
||||
<Caret Line="3741" Column="54" TopLine="3717"/>
|
||||
</Position3>
|
||||
<Position4>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="51" Column="31" TopLine="32"/>
|
||||
<Filename Value="../../rxdbgrid.pas"/>
|
||||
<Caret Line="4741" Column="43" TopLine="4716"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="58" Column="17" TopLine="39"/>
|
||||
<Filename Value="../../rxdbgrid.pas"/>
|
||||
<Caret Line="5153" Column="75" TopLine="5128"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="59" Column="17" TopLine="40"/>
|
||||
<Filename Value="../../rxdbgrid.pas"/>
|
||||
<Caret Line="5285" Column="47" TopLine="5260"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="68" Column="3" TopLine="47"/>
|
||||
<Filename Value="../../rxdbgrid.pas"/>
|
||||
<Caret Line="6155" Column="16" TopLine="6129"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="69" Column="3" TopLine="48"/>
|
||||
<Filename Value="../../rxdbgrid.pas"/>
|
||||
<Caret Line="446" Column="17" TopLine="425"/>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="../../rxdbgrid.pas"/>
|
||||
<Caret Line="3741" Column="54" TopLine="3717"/>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="../../rxdbgrid.pas"/>
|
||||
<Caret Line="4741" Column="83" TopLine="4729"/>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="../../rxdbgrid.pas"/>
|
||||
<Caret Line="5151" Column="63" TopLine="5128"/>
|
||||
</Position11>
|
||||
<Position12>
|
||||
<Filename Value="../../rxdbgrid.pas"/>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="../../rxdbgrid.pas"/>
|
||||
<Caret Line="369" Column="16" TopLine="344"/>
|
||||
</Position13>
|
||||
<Position14>
|
||||
<Filename Value="../../rxdbgrid.pas"/>
|
||||
<Caret Line="390" Column="67" TopLine="366"/>
|
||||
</Position14>
|
||||
<Position15>
|
||||
<Filename Value="../../rxdbgrid.pas"/>
|
||||
<Caret Line="3741" Column="54" TopLine="3717"/>
|
||||
</Position15>
|
||||
<Position16>
|
||||
<Filename Value="../../rxdbgrid.pas"/>
|
||||
<Caret Line="4741" Column="44" TopLine="4716"/>
|
||||
</Position16>
|
||||
<Position17>
|
||||
<Filename Value="../../rxdbgrid.pas"/>
|
||||
<Caret Line="5153" Column="75" TopLine="5128"/>
|
||||
</Position17>
|
||||
<Position18>
|
||||
<Filename Value="../../rxdbgrid.pas"/>
|
||||
<Caret Line="5285" Column="47" TopLine="5260"/>
|
||||
</Position18>
|
||||
<Position19>
|
||||
<Filename Value="../../rxdbgrid.pas"/>
|
||||
<Caret Line="6154" Column="14" TopLine="6129"/>
|
||||
</Position19>
|
||||
<Position20>
|
||||
<Filename Value="../../rxdbgrid.pas"/>
|
||||
<Caret Line="5153" Column="76" TopLine="5132"/>
|
||||
</Position20>
|
||||
<Position21>
|
||||
<Filename Value="../../rxdbgrid.pas"/>
|
||||
<Caret Line="387" Column="52" TopLine="359"/>
|
||||
</Position21>
|
||||
<Position22>
|
||||
<Filename Value="../../rxdbgrid.pas"/>
|
||||
<Caret Line="397" Column="51" TopLine="368"/>
|
||||
</Position22>
|
||||
<Position23>
|
||||
<Filename Value="../../rxdbgrid.pas"/>
|
||||
<Caret Line="3746" Column="54" TopLine="3721"/>
|
||||
</Position23>
|
||||
<Position24>
|
||||
<Filename Value="../../rxdbgrid.pas"/>
|
||||
<Caret Line="750" Column="15" TopLine="737"/>
|
||||
</Position24>
|
||||
<Position25>
|
||||
<Filename Value="../../rxdbgrid.pas"/>
|
||||
<Caret Line="709" Column="15" TopLine="696"/>
|
||||
</Position25>
|
||||
<Position26>
|
||||
<Filename Value="../../rxdbgrid.pas"/>
|
||||
<Caret Line="3745" Column="94" TopLine="3721"/>
|
||||
</Position26>
|
||||
<Position27>
|
||||
<Filename Value="../../rxdbgrid.pas"/>
|
||||
<Caret Line="4748" Column="44" TopLine="4723"/>
|
||||
</Position27>
|
||||
<Position28>
|
||||
<Filename Value="../../rxdbgrid.pas"/>
|
||||
<Caret Line="5175" Column="29" TopLine="5152"/>
|
||||
</Position28>
|
||||
<Position29>
|
||||
<Filename Value="../../rxdbgrid.pas"/>
|
||||
<Caret Line="470" Column="14" TopLine="462"/>
|
||||
</Position29>
|
||||
<Position30>
|
||||
<Filename Value="../../rxdbgrid.pas"/>
|
||||
<Caret Line="5181" TopLine="5154"/>
|
||||
</Position30>
|
||||
</JumpHistory>
|
||||
</ProjectSession>
|
||||
</CONFIG>
|
||||
|
@ -161,7 +161,7 @@ object Form1: TForm1
|
||||
Enabled = True
|
||||
end>
|
||||
FooterOptions.DrawFullLine = False
|
||||
OptionsRx = [rdgAllowColumnsForm, rdgAllowDialogFind, rdgAllowQuickFilter]
|
||||
OptionsRx = [rdgAllowColumnsForm, rdgAllowDialogFind, rdgAllowQuickFilter, rdgAllowToolMenu]
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
Color = clWindow
|
||||
DrawFullLine = False
|
||||
|
@ -71,7 +71,7 @@ begin
|
||||
except
|
||||
on E:Exception do
|
||||
Memo1.Lines.Text:=E.Message;
|
||||
end; mon
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -403,6 +403,10 @@ msgstr "Tomar estructura..."
|
||||
msgid "Copy only metadata"
|
||||
msgstr "Copiar solo metadata"
|
||||
|
||||
#: rxdconst.srxdbgridallfilter
|
||||
msgid "(All values)"
|
||||
msgstr ""
|
||||
|
||||
#: rxdconst.srxdbgridcopycellvalue
|
||||
msgid "Copy cell value"
|
||||
msgstr ""
|
||||
|
@ -389,6 +389,10 @@ msgstr ""
|
||||
msgid "Copy only metadata"
|
||||
msgstr ""
|
||||
|
||||
#: rxdconst.srxdbgridallfilter
|
||||
msgid "(All values)"
|
||||
msgstr ""
|
||||
|
||||
#: rxdconst.srxdbgridcopycellvalue
|
||||
msgid "Copy cell value"
|
||||
msgstr ""
|
||||
|
@ -399,13 +399,17 @@ msgstr "Обзор структуры..."
|
||||
msgid "Copy only metadata"
|
||||
msgstr "Копировать только метаданные..."
|
||||
|
||||
#: rxdconst.srxdbgridallfilter
|
||||
msgid "(All values)"
|
||||
msgstr ""
|
||||
|
||||
#: rxdconst.srxdbgridcopycellvalue
|
||||
msgid "Copy cell value"
|
||||
msgstr "Копировать значение ячейки"
|
||||
|
||||
#: rxdconst.srxdbgridemptifilter
|
||||
msgid "(Empty)"
|
||||
msgstr "(Нет)"
|
||||
msgstr "(Пусто)"
|
||||
|
||||
#: rxdconst.srxdbgridfilter
|
||||
msgid "Filter data"
|
||||
|
@ -401,6 +401,10 @@ msgstr "Огляд структури ..."
|
||||
msgid "Copy only metadata"
|
||||
msgstr "Копіювати тільки метадані ..."
|
||||
|
||||
#: rxdconst.srxdbgridallfilter
|
||||
msgid "(All values)"
|
||||
msgstr ""
|
||||
|
||||
#: rxdconst.srxdbgridcopycellvalue
|
||||
msgid "Copy cell value"
|
||||
msgstr "Копіювати значення комірки"
|
||||
|
@ -361,7 +361,10 @@ type
|
||||
|
||||
TRxColumnFilter = class(TPersistent)
|
||||
private
|
||||
FAllValue: string;
|
||||
FEnabled: boolean;
|
||||
FIsAll: boolean;
|
||||
FIsNull: boolean;
|
||||
FOwner: TRxColumn;
|
||||
FValue: string;
|
||||
FValueList: TStringList;
|
||||
@ -380,6 +383,8 @@ type
|
||||
destructor Destroy; override;
|
||||
published
|
||||
property Value: string read FValue write FValue;
|
||||
property IsNull:boolean read FIsNull write FIsNull;
|
||||
property IsAll:boolean read FIsAll write FIsAll;
|
||||
property Font: TFont read FFont write SetFont;
|
||||
property Alignment: TAlignment read FAlignment write FAlignment default
|
||||
taLeftJustify;
|
||||
@ -387,6 +392,7 @@ type
|
||||
property Color: TColor read FColor write SetColor default clWhite;
|
||||
property ValueList: TStringList read FValueList write FValueList;
|
||||
property EmptyValue: string read FEmptyValue write FEmptyValue;
|
||||
property AllValue: string read FAllValue write FAllValue;
|
||||
property EmptyFont: TFont read FEmptyFont write FEmptyFont;
|
||||
property ItemIndex: integer read GetItemIndex write SetItemIndex;
|
||||
property Enabled:boolean read FEnabled write FEnabled default true;
|
||||
@ -3735,8 +3741,11 @@ begin
|
||||
TxS.Alignment := taLeftJustify;
|
||||
|
||||
Canvas.TextStyle := TxS;
|
||||
DrawCellText(aCol, aRow, aRect, aState,
|
||||
TRxColumn(Columns[MyCol]).Filter.EmptyValue);
|
||||
if IsNull then
|
||||
DrawCellText(aCol, aRow, aRect, aState, TRxColumn(Columns[MyCol]).Filter.EmptyValue)
|
||||
else
|
||||
if IsAll then
|
||||
DrawCellText(aCol, aRow, aRect, aState, TRxColumn(Columns[MyCol]).Filter.AllValue)
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -4736,10 +4745,25 @@ begin
|
||||
FFilterListEditor.Hide;
|
||||
with TRxColumn(Columns[Columns.RealIndex(FFilterListEditor.Col)]).Filter do
|
||||
begin
|
||||
if FFilterListEditor.Text = EmptyValue then
|
||||
Value := ''
|
||||
if (FFilterListEditor.Text = EmptyValue) then
|
||||
begin
|
||||
Value := '';
|
||||
IsNull:=true;
|
||||
IsAll:=false;
|
||||
end
|
||||
else
|
||||
if (FFilterListEditor.Text = AllValue) then
|
||||
begin
|
||||
Value := '';
|
||||
IsNull:=false;
|
||||
IsAll:=true;
|
||||
end
|
||||
else
|
||||
begin
|
||||
Value := FFilterListEditor.Text;
|
||||
IsNull:=false;
|
||||
IsAll:=false;
|
||||
end;
|
||||
end;
|
||||
|
||||
// DataSource.DataSet.Refresh;
|
||||
@ -5139,6 +5163,12 @@ begin
|
||||
begin
|
||||
with TRxColumn(Columns[i]) do
|
||||
begin
|
||||
if Filter.IsAll then
|
||||
Accept:=true
|
||||
else
|
||||
if Filter.IsNull then
|
||||
Accept:=Field.IsNull
|
||||
else
|
||||
if (Filter.Value <> '') then
|
||||
begin
|
||||
if (Filter.Value <> Field.DisplayText) then
|
||||
@ -5147,6 +5177,7 @@ begin
|
||||
break;
|
||||
end;
|
||||
end;
|
||||
|
||||
end;
|
||||
end;
|
||||
if Assigned(F_EventOnFilterRec) then
|
||||
@ -5278,6 +5309,7 @@ begin
|
||||
C.Filter.Value := '';
|
||||
C.Filter.ItemIndex := -1;
|
||||
C.Filter.ValueList.Add(C.Filter.EmptyValue);
|
||||
C.Filter.ValueList.Add(C.Filter.AllValue);
|
||||
end;
|
||||
|
||||
if DatalinkActive then
|
||||
@ -6143,9 +6175,12 @@ begin
|
||||
FValueList := TStringList.Create;
|
||||
FValueList.Sorted := True;
|
||||
FColor := clWhite;
|
||||
FIsNull:=false;
|
||||
FIsAll:=true;
|
||||
|
||||
FEmptyFont.Style := [fsItalic];
|
||||
FEmptyValue := sRxDBGridEmptiFilter;
|
||||
FAllValue := sRxDBGridAllFilter;
|
||||
FEnabled:=true;
|
||||
end;
|
||||
|
||||
|
@ -115,6 +115,7 @@ resourcestring
|
||||
sRxDBGridSortByColumns = 'Sort data for columns';// Ctrl+C';'Ordenar por Columnas Ctrl+C';
|
||||
sRxDBGridSelectColumns = 'Select visible columns';// Ctrl+W';'Seleccionar Columnas Ctrl+W';
|
||||
sRxDBGridEmptiFilter = '(Empty)';
|
||||
sRxDBGridAllFilter = '(All values)';
|
||||
sRxDBGridSelectAllRows = 'Select all rows';// Ctrl+W';'Seleccionar Columnas Ctrl+W';
|
||||
sRxDBGridCopyCellValue = 'Copy cell value';// Ctrl+W';'Seleccionar Columnas Ctrl+W';
|
||||
|
||||
|
Reference in New Issue
Block a user