You've already forked lazarus-ccr
RxFPC:RxDBGrid - new style for filter - rxfstBoth
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6101 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="10"/>
|
||||
<Version Value="11"/>
|
||||
<General>
|
||||
<Flags>
|
||||
<LRSInOutputDirectory Value="False"/>
|
||||
@ -31,10 +31,14 @@
|
||||
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
|
||||
</local>
|
||||
<FormatVersion Value="2"/>
|
||||
<Modes Count="1">
|
||||
<Mode0 Name="default">
|
||||
<local>
|
||||
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
|
||||
</local>
|
||||
</Mode0>
|
||||
</Modes>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="5">
|
||||
<Item1>
|
||||
@ -55,13 +59,13 @@
|
||||
<MinVersion Major="1" Release="18" Build="56" Valid="True"/>
|
||||
</Item5>
|
||||
</RequiredPackages>
|
||||
<Units Count="65">
|
||||
<Units Count="67">
|
||||
<Unit0>
|
||||
<Filename Value="RxDBGridDemo.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<CursorPos Y="17"/>
|
||||
<UsageCount Value="127"/>
|
||||
<UsageCount Value="129"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="rxdbgridmainunit.pas"/>
|
||||
@ -70,10 +74,9 @@
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="RxDBGridMainUnit"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<TopLine Value="126"/>
|
||||
<CursorPos X="51" Y="152"/>
|
||||
<UsageCount Value="127"/>
|
||||
<TopLine Value="152"/>
|
||||
<CursorPos X="138" Y="188"/>
|
||||
<UsageCount Value="129"/>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
</Unit1>
|
||||
@ -474,10 +477,16 @@
|
||||
</Unit56>
|
||||
<Unit57>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="404"/>
|
||||
<CursorPos X="14" Y="422"/>
|
||||
<UsageCount Value="11"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<TopLine Value="5975"/>
|
||||
<CursorPos X="98" Y="6004"/>
|
||||
<UsageCount Value="12"/>
|
||||
<Bookmarks Count="2">
|
||||
<Item0 X="3" Y="7314" ID="1"/>
|
||||
<Item1 X="17" Y="4353" ID="2"/>
|
||||
</Bookmarks>
|
||||
<Loaded Value="True"/>
|
||||
</Unit57>
|
||||
<Unit58>
|
||||
<Filename Value="../../../rxdb/rxmemds.pas"/>
|
||||
@ -506,10 +515,11 @@
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="RxDBGrid_PopUpFilterUnit"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="154"/>
|
||||
<CursorPos X="14" Y="180"/>
|
||||
<UsageCount Value="10"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<TopLine Value="142"/>
|
||||
<CursorPos X="3" Y="161"/>
|
||||
<UsageCount Value="11"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit61>
|
||||
<Unit62>
|
||||
<Filename Value="../../../rxtools/rxfileutils.pas"/>
|
||||
@ -534,16 +544,143 @@
|
||||
<CursorPos X="26" Y="119"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit64>
|
||||
<Unit65>
|
||||
<Filename Value="/home/install/source/fpcsrc/rtl/inc/typshrdh.inc"/>
|
||||
<EditorIndex Value="3"/>
|
||||
<TopLine Value="126"/>
|
||||
<CursorPos X="17" Y="154"/>
|
||||
<UsageCount Value="11"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit65>
|
||||
<Unit66>
|
||||
<Filename Value="/home/install/source/fpcsrc/rtl/objpas/classes/classesh.inc"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="706"/>
|
||||
<CursorPos X="14" Y="723"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit66>
|
||||
</Units>
|
||||
<JumpHistory Count="2" HistoryIndex="1">
|
||||
<JumpHistory Count="30" HistoryIndex="29">
|
||||
<Position1>
|
||||
<Filename Value="rxdbgridmainunit.pas"/>
|
||||
<Caret Line="117" TopLine="86"/>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="5975" TopLine="5967"/>
|
||||
</Position1>
|
||||
<Position2>
|
||||
<Filename Value="rxdbgridmainunit.pas"/>
|
||||
<Caret Line="117" Column="70" TopLine="86"/>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="5977" TopLine="5967"/>
|
||||
</Position2>
|
||||
<Position3>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="5979" TopLine="5967"/>
|
||||
</Position3>
|
||||
<Position4>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="5980" TopLine="5967"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="5975" TopLine="5967"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="5977" TopLine="5967"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="5979" TopLine="5967"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="5980" TopLine="5967"/>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="5975" TopLine="5967"/>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="5977" TopLine="5967"/>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="5979" TopLine="5967"/>
|
||||
</Position11>
|
||||
<Position12>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="5982" TopLine="5967"/>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="5989" TopLine="5967"/>
|
||||
</Position13>
|
||||
<Position14>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="6007" TopLine="5989"/>
|
||||
</Position14>
|
||||
<Position15>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="6025" TopLine="5992"/>
|
||||
</Position15>
|
||||
<Position16>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="6018" TopLine="5992"/>
|
||||
</Position16>
|
||||
<Position17>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="6013" Column="57" TopLine="5992"/>
|
||||
</Position17>
|
||||
<Position18>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="5974" TopLine="5994"/>
|
||||
</Position18>
|
||||
<Position19>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="6010" Column="15" TopLine="5995"/>
|
||||
</Position19>
|
||||
<Position20>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="6018" Column="16" TopLine="5995"/>
|
||||
</Position20>
|
||||
<Position21>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="6012" Column="11" TopLine="5994"/>
|
||||
</Position21>
|
||||
<Position22>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="6028" Column="80" TopLine="5991"/>
|
||||
</Position22>
|
||||
<Position23>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="6019" TopLine="5992"/>
|
||||
</Position23>
|
||||
<Position24>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="5977" TopLine="5974"/>
|
||||
</Position24>
|
||||
<Position25>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="5979" TopLine="5972"/>
|
||||
</Position25>
|
||||
<Position26>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="5980" TopLine="5972"/>
|
||||
</Position26>
|
||||
<Position27>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="5981" TopLine="5972"/>
|
||||
</Position27>
|
||||
<Position28>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="6010" TopLine="5977"/>
|
||||
</Position28>
|
||||
<Position29>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="5988" Column="27" TopLine="5967"/>
|
||||
</Position29>
|
||||
<Position30>
|
||||
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Caret Line="5989" TopLine="5972"/>
|
||||
</Position30>
|
||||
</JumpHistory>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
@ -575,7 +712,7 @@
|
||||
<WatchScope Value="wpsLocal"/>
|
||||
<WatchKind Value="wpkWrite"/>
|
||||
<Source Value="../../../rxdb/rxdbgrid.pas"/>
|
||||
<Line Value="6068"/>
|
||||
<Line Value="6094"/>
|
||||
</Item1>
|
||||
</BreakPoints>
|
||||
<Exceptions Count="2">
|
||||
|
@ -36,6 +36,7 @@ object RxDBGridMainForm: TRxDBGridMainForm
|
||||
Filter.Font.Style = [fsItalic]
|
||||
Filter.DropDownRows = 0
|
||||
Filter.EmptyValue = '(Нет)'
|
||||
Filter.NotEmptyValue = '(Не пусто)'
|
||||
Filter.AllValue = '(All values)'
|
||||
Filter.EmptyFont.Style = [fsItalic]
|
||||
Filter.ItemIndex = -1
|
||||
@ -61,6 +62,7 @@ object RxDBGridMainForm: TRxDBGridMainForm
|
||||
Filter.DropDownRows = 0
|
||||
Filter.Color = clLime
|
||||
Filter.EmptyValue = '(Нет)'
|
||||
Filter.NotEmptyValue = '(Не пусто)'
|
||||
Filter.AllValue = '(All values)'
|
||||
Filter.EmptyFont.Style = [fsItalic]
|
||||
Filter.ItemIndex = -1
|
||||
@ -83,10 +85,11 @@ object RxDBGridMainForm: TRxDBGridMainForm
|
||||
Filter.DropDownRows = 0
|
||||
Filter.Color = clLime
|
||||
Filter.EmptyValue = '(Пустые значения)'
|
||||
Filter.NotEmptyValue = '(Не пусто)'
|
||||
Filter.AllValue = '(Все значения)'
|
||||
Filter.EmptyFont.Style = [fsItalic]
|
||||
Filter.ItemIndex = -1
|
||||
Filter.Style = rxfstDialog
|
||||
Filter.Style = rxfstBoth
|
||||
Footer.Value = 'This is test'
|
||||
Footer.ValueType = fvtStaticText
|
||||
Footer.Font.Color = clRed
|
||||
@ -110,6 +113,7 @@ object RxDBGridMainForm: TRxDBGridMainForm
|
||||
Filter.DropDownRows = 0
|
||||
Filter.Color = clLime
|
||||
Filter.EmptyValue = '(Нет)'
|
||||
Filter.NotEmptyValue = '(Не пусто)'
|
||||
Filter.AllValue = '(All values)'
|
||||
Filter.EmptyFont.Style = [fsItalic]
|
||||
Filter.ItemIndex = -1
|
||||
@ -144,6 +148,7 @@ object RxDBGridMainForm: TRxDBGridMainForm
|
||||
Filter.DropDownRows = 0
|
||||
Filter.Color = clLime
|
||||
Filter.EmptyValue = '(Нет)'
|
||||
Filter.NotEmptyValue = '(Не пусто)'
|
||||
Filter.AllValue = '(All values)'
|
||||
Filter.EmptyFont.Style = [fsItalic]
|
||||
Filter.ItemIndex = -1
|
||||
@ -177,6 +182,7 @@ object RxDBGridMainForm: TRxDBGridMainForm
|
||||
Filter.Font.Style = [fsItalic]
|
||||
Filter.DropDownRows = 0
|
||||
Filter.EmptyValue = '(Нет)'
|
||||
Filter.NotEmptyValue = '(Не пусто)'
|
||||
Filter.AllValue = '(All values)'
|
||||
Filter.EmptyFont.Style = [fsItalic]
|
||||
Filter.ItemIndex = -1
|
||||
@ -194,6 +200,7 @@ object RxDBGridMainForm: TRxDBGridMainForm
|
||||
Filter.Font.Style = [fsItalic]
|
||||
Filter.DropDownRows = 0
|
||||
Filter.EmptyValue = '(Нет)'
|
||||
Filter.NotEmptyValue = '(Не пусто)'
|
||||
Filter.AllValue = '(All values)'
|
||||
Filter.EmptyFont.Style = [fsItalic]
|
||||
Filter.ItemIndex = -1
|
||||
@ -355,6 +362,7 @@ object RxDBGridMainForm: TRxDBGridMainForm
|
||||
Filter.Font.Style = [fsItalic]
|
||||
Filter.DropDownRows = 0
|
||||
Filter.EmptyValue = '(Нет)'
|
||||
Filter.NotEmptyValue = '(Не пусто)'
|
||||
Filter.AllValue = '(All values)'
|
||||
Filter.EmptyFont.Style = [fsItalic]
|
||||
Filter.ItemIndex = -1
|
||||
|
@ -384,13 +384,14 @@ type
|
||||
{ TRxColumnFilter }
|
||||
|
||||
TRxFilterState = (rxfsAll, rxfsEmpty, rxfsNonEmpty, rxfsFilter{, rxfsTopXXXX});
|
||||
TRxFilterStyle = (rxfstSimple, rxfstDialog, rxfstManualEdit);
|
||||
TRxFilterStyle = (rxfstSimple, rxfstDialog, rxfstManualEdit, rxfstBoth);
|
||||
|
||||
TRxColumnFilter = class(TPersistent)
|
||||
private
|
||||
FAllValue: string;
|
||||
FCurrentValues: TStringList;
|
||||
FEnabled: boolean;
|
||||
FManulEditValue: string;
|
||||
FNotEmptyValue: string;
|
||||
FOwner: TRxColumn;
|
||||
FState: TRxFilterState;
|
||||
@ -402,6 +403,7 @@ type
|
||||
FAlignment: TAlignment;
|
||||
FDropDownRows: integer;
|
||||
FColor: TColor;
|
||||
function GetDisplayFilterValue: string;
|
||||
function GetItemIndex: integer;
|
||||
procedure SetColor(const AValue: TColor);
|
||||
procedure SetFont(const AValue: TFont);
|
||||
@ -409,8 +411,12 @@ type
|
||||
public
|
||||
constructor Create(Owner: TRxColumn); virtual;
|
||||
destructor Destroy; override;
|
||||
procedure ClearFilter;
|
||||
|
||||
property State:TRxFilterState read FState write FState;
|
||||
property CurrentValues : TStringList read FCurrentValues;
|
||||
property ManulEditValue : string read FManulEditValue write FManulEditValue;
|
||||
property DisplayFilterValue:string read GetDisplayFilterValue;
|
||||
published
|
||||
property Font: TFont read FFont write SetFont;
|
||||
property Alignment: TAlignment read FAlignment write FAlignment default
|
||||
@ -3446,19 +3452,14 @@ begin
|
||||
|
||||
if rdgFilter in OptionsRx then
|
||||
begin
|
||||
if Assigned(FFilterListEditor) then
|
||||
begin
|
||||
RowHeights[0] := RowHeights[0] + FFilterListEditor.Height
|
||||
end
|
||||
else
|
||||
H:=FDefRowH;
|
||||
if Assigned(FFilterListEditor) then
|
||||
H:=Max(H, FFilterListEditor.Height);
|
||||
|
||||
if Assigned(FFilterSimpleEdit) then
|
||||
begin
|
||||
RowHeights[0] := RowHeights[0] + FFilterSimpleEdit.Height
|
||||
end
|
||||
else
|
||||
begin
|
||||
RowHeights[0] := RowHeights[0] + FDefRowH;
|
||||
end;
|
||||
H:=Max(H, FFilterSimpleEdit.Height);
|
||||
|
||||
RowHeights[0] := RowHeights[0] + H;
|
||||
end;
|
||||
|
||||
finally
|
||||
@ -4336,6 +4337,18 @@ begin
|
||||
Canvas.FillRect(aRect);
|
||||
end;
|
||||
|
||||
S:=DisplayFilterValue;
|
||||
if (aRect.Right - aRect.Left) >= Canvas.TextWidth(S) then
|
||||
TxS.Alignment := Alignment
|
||||
else
|
||||
TxS.Alignment := taLeftJustify;
|
||||
Canvas.TextStyle := TxS;
|
||||
|
||||
if State in [rxfsEmpty, rxfsNonEmpty] then
|
||||
Canvas.Font := TRxColumn(Columns[MyCol]).Filter.EmptyFont;
|
||||
|
||||
DrawCellText(aCol, aRow, aRect, aState, S);
|
||||
(*
|
||||
if CurrentValues.Count > 0 then
|
||||
begin
|
||||
S:=CurrentValues[0];
|
||||
@ -4351,14 +4364,17 @@ begin
|
||||
end
|
||||
else
|
||||
begin
|
||||
if (Style in (rxfstManualEdit, rxfstBoth)) and (ManulEditValue<>'') then
|
||||
S:=ManulEditValue
|
||||
else
|
||||
if State = rxfsEmpty then
|
||||
S:=TRxColumn(Columns[MyCol]).Filter.EmptyValue
|
||||
S:=Filter.EmptyValue
|
||||
else
|
||||
if State = rxfsNonEmpty then
|
||||
S:=TRxColumn(Columns[MyCol]).Filter.NotEmptyValue
|
||||
S:=Filter.NotEmptyValue
|
||||
else
|
||||
if State = rxfsAll then
|
||||
S:=TRxColumn(Columns[MyCol]).Filter.AllValue
|
||||
S:=Filter.AllValue
|
||||
else
|
||||
S:='';
|
||||
|
||||
@ -4370,7 +4386,7 @@ begin
|
||||
|
||||
Canvas.TextStyle := TxS;
|
||||
DrawCellText(aCol, aRow, aRect, aState, S)
|
||||
end;
|
||||
end; *)
|
||||
end;
|
||||
|
||||
// Canvas.Font := ft;
|
||||
@ -4965,12 +4981,13 @@ begin
|
||||
FFilterSimpleEdit.Height := Rect.Bottom - Rect.Top;
|
||||
FFilterSimpleEdit.BoundsRect := Rect;
|
||||
FFilterSimpleEdit.Show(Self, Cell.x - 1);
|
||||
if C.Filter.CurrentValues.Count>0 then
|
||||
FFilterSimpleEdit.Text := C.Filter.CurrentValues[0]
|
||||
else
|
||||
FFilterSimpleEdit.Text := '';
|
||||
{ if C.Filter.CurrentValues.Count>0 then
|
||||
FFilterSimpleEdit.Text := C.Filter.CurrentValues[C.Filter.CurrentValues.Count - 1]
|
||||
else}
|
||||
FFilterSimpleEdit.Text := C.Filter.ManulEditValue;
|
||||
end
|
||||
else
|
||||
if C.Filter.Style = rxfstDialog then
|
||||
begin
|
||||
if FFilterListEditor.Visible then
|
||||
FFilterListEditor.Hide;
|
||||
@ -4985,6 +5002,30 @@ begin
|
||||
FFilterColDlgButton.Left := Rect.Right - FFilterColDlgButton.Width;
|
||||
FFilterColDlgButton.Show(Self, Cell.x - 1);
|
||||
end
|
||||
else
|
||||
if C.Filter.Style = rxfstBoth then
|
||||
begin
|
||||
if FFilterListEditor.Visible then
|
||||
FFilterListEditor.Hide;
|
||||
|
||||
FFilterColDlgButton.Parent:=Self;
|
||||
FFilterColDlgButton.Width := 32;
|
||||
FFilterColDlgButton.Height := Rect.Bottom - Rect.Top;
|
||||
FFilterColDlgButton.Top := Rect.Top;
|
||||
FFilterColDlgButton.Left := Rect.Right - FFilterColDlgButton.Width;
|
||||
FFilterColDlgButton.Show(Self, Cell.x - 1);
|
||||
|
||||
FFilterSimpleEdit.Parent := Self;
|
||||
FFilterSimpleEdit.Width := Rect.Right - Rect.Left - FFilterColDlgButton.Width;
|
||||
FFilterSimpleEdit.Height := Rect.Bottom - Rect.Top;
|
||||
Rect.Width:=Rect.Width - FFilterColDlgButton.Width;
|
||||
FFilterSimpleEdit.BoundsRect := Rect;
|
||||
FFilterSimpleEdit.Show(Self, Cell.x - 1);
|
||||
{ if C.Filter.CurrentValues.Count>0 then
|
||||
FFilterSimpleEdit.Text := C.Filter.CurrentValues[0]
|
||||
else}
|
||||
FFilterSimpleEdit.Text := C.Filter.ManulEditValue;
|
||||
end
|
||||
end;
|
||||
exit;
|
||||
end;
|
||||
@ -5425,18 +5466,19 @@ begin
|
||||
begin
|
||||
if (FFilterListEditor.Text = EmptyValue) then
|
||||
begin
|
||||
CurrentValues.Clear;
|
||||
State:=rxfsEmpty;
|
||||
ClearFilter;
|
||||
{ CurrentValues.Clear;
|
||||
State:=rxfsEmpty;}
|
||||
end
|
||||
else
|
||||
if (FFilterListEditor.Text = AllValue) then
|
||||
begin
|
||||
CurrentValues.Clear;
|
||||
ClearFilter;
|
||||
State:=rxfsAll;
|
||||
end
|
||||
else
|
||||
begin
|
||||
CurrentValues.Clear;
|
||||
ClearFilter;
|
||||
CurrentValues.Add(FFilterListEditor.Text);
|
||||
State:=rxfsFilter;
|
||||
end;
|
||||
@ -5493,16 +5535,14 @@ procedure TRxDBGrid.FFilterSimpleEditOnChange(Sender: TObject);
|
||||
begin
|
||||
with TRxColumn(Columns[Columns.RealIndex(FFilterSimpleEdit.Col)]).Filter do
|
||||
begin
|
||||
if FFilterSimpleEdit.Text = '' then
|
||||
if (FFilterSimpleEdit.Text = '') and (Style = rxfstManualEdit) then
|
||||
begin
|
||||
CurrentValues.Clear;
|
||||
State:=rxfsAll;
|
||||
end
|
||||
else
|
||||
begin
|
||||
CurrentValues.Text:=FFilterSimpleEdit.Text;
|
||||
State:=rxfsFilter;
|
||||
end;
|
||||
ManulEditValue:=FFilterSimpleEdit.Text;
|
||||
end;
|
||||
|
||||
DataSource.DataSet.DisableControls;
|
||||
@ -5930,29 +5970,23 @@ end;
|
||||
procedure TRxDBGrid.FilterRec(DataSet: TDataSet; var Accept: boolean);
|
||||
var
|
||||
i: integer;
|
||||
Filter: TRxColumnFilter;
|
||||
F: TField;
|
||||
begin
|
||||
Accept := True;
|
||||
for i := 0 to Columns.Count - 1 do
|
||||
begin
|
||||
with TRxColumn(Columns[i]) do
|
||||
begin
|
||||
if Filter.State = rxfsAll then
|
||||
Accept:=true
|
||||
else
|
||||
if Filter.State = rxfsEmpty then
|
||||
begin
|
||||
Accept:=Field.IsNull;
|
||||
if not Accept then
|
||||
Break;
|
||||
end
|
||||
else
|
||||
if Filter.State = rxfsNonEmpty then
|
||||
begin
|
||||
Accept:=not Field.IsNull;
|
||||
if not Accept then
|
||||
Break;
|
||||
end
|
||||
else
|
||||
Filter:=TRxColumn(Columns[i]).Filter;
|
||||
F:=TRxColumn(Columns[i]).Field;
|
||||
if Filter.State = rxfsAll then
|
||||
Accept:=true
|
||||
else
|
||||
if Filter.State = rxfsEmpty then
|
||||
Accept:=F.IsNull
|
||||
else
|
||||
if Filter.State = rxfsNonEmpty then
|
||||
Accept:=not F.IsNull
|
||||
else
|
||||
{ if Filter.State = rxfsTopXXXX then
|
||||
begin
|
||||
if DataSet.State = dsFilter then
|
||||
@ -5963,23 +5997,15 @@ begin
|
||||
Break;
|
||||
end
|
||||
else}
|
||||
begin
|
||||
if Filter.CurrentValues.Count > 0 then
|
||||
begin
|
||||
if Filter.Style = rxfstManualEdit then
|
||||
begin
|
||||
if UTF8Pos(UTF8UpperCase(Filter.CurrentValues[0]), UTF8UpperCase(Field.DisplayText)) < 1 then
|
||||
begin
|
||||
Accept := False;
|
||||
break;
|
||||
end;
|
||||
end
|
||||
else
|
||||
if Filter.CurrentValues.IndexOf(Field.DisplayText) < 0 then
|
||||
begin
|
||||
Accept := False;
|
||||
break;
|
||||
end;
|
||||
end
|
||||
Accept := Filter.CurrentValues.IndexOf(F.DisplayText) >= 0;
|
||||
|
||||
if Accept and (Filter.Style in [rxfstBoth, rxfstManualEdit]) and (Filter.ManulEditValue<>'') then
|
||||
Accept := UTF8Pos(UTF8UpperCase(Filter.ManulEditValue), UTF8UpperCase(F.DisplayText)) > 0;
|
||||
|
||||
if not Accept then
|
||||
Break;
|
||||
end;
|
||||
end;
|
||||
if Assigned(F_EventOnFilterRec) then
|
||||
@ -6109,6 +6135,7 @@ begin
|
||||
C := TRxColumn(Columns[i]);
|
||||
C.Filter.ValueList.Clear;
|
||||
C.Filter.CurrentValues.Clear;
|
||||
C.Filter.ManulEditValue:='';
|
||||
C.Filter.ItemIndex := -1;
|
||||
C.Filter.ValueList.Add(C.Filter.EmptyValue);
|
||||
C.Filter.ValueList.Add(C.Filter.AllValue);
|
||||
@ -7263,6 +7290,29 @@ begin
|
||||
Result := -1;
|
||||
end;
|
||||
|
||||
function TRxColumnFilter.GetDisplayFilterValue: string;
|
||||
begin
|
||||
Result:='';
|
||||
if CurrentValues.Count > 0 then
|
||||
begin
|
||||
Result:=CurrentValues[0];
|
||||
if CurrentValues.Count > 1 then
|
||||
Result:=Result + '(...)';
|
||||
end
|
||||
else
|
||||
if (Style in [rxfstManualEdit, rxfstBoth]) and (ManulEditValue<>'') then
|
||||
Result:=ManulEditValue
|
||||
else
|
||||
if State = rxfsEmpty then
|
||||
Result:=EmptyValue
|
||||
else
|
||||
if State = rxfsNonEmpty then
|
||||
Result:=NotEmptyValue
|
||||
else
|
||||
if State = rxfsAll then
|
||||
Result:=AllValue;
|
||||
end;
|
||||
|
||||
procedure TRxColumnFilter.SetColor(const AValue: TColor);
|
||||
begin
|
||||
if FColor = AValue then
|
||||
@ -7320,6 +7370,13 @@ begin
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
procedure TRxColumnFilter.ClearFilter;
|
||||
begin
|
||||
CurrentValues.Clear;
|
||||
FManulEditValue:='';
|
||||
FState:=rxfsEmpty;
|
||||
end;
|
||||
|
||||
{ TExDBGridSortEngine }
|
||||
|
||||
procedure TRxDBGridSortEngine.SortList(ListField: string; ADataSet: TDataSet;
|
||||
|
@ -153,12 +153,17 @@ end;
|
||||
|
||||
procedure TRxDBGrid_PopUpFilterForm.UpdateChList;
|
||||
var
|
||||
i: Integer;
|
||||
i, Cnt: Integer;
|
||||
S: String;
|
||||
begin
|
||||
CheckListBox1.Items.BeginUpdate;
|
||||
CheckListBox1.Items.Clear;
|
||||
for i:=0 to FRxColumn.Filter.ValueList.Count - 1 do
|
||||
Cnt:=FRxColumn.Filter.ValueList.Count - 1;
|
||||
|
||||
if FRxColumn.Filter.Style = rxfstBoth then
|
||||
Dec(Cnt);
|
||||
|
||||
for i:=0 to Cnt do
|
||||
begin
|
||||
S:=FRxColumn.Filter.ValueList[i];
|
||||
if (S <> FRxColumn.Filter.AllValue) and (S <> FRxColumn.Filter.EmptyValue) then
|
||||
|
Reference in New Issue
Block a user