You've already forked lazarus-ccr
RxFPC: new property for RxDBGrid - SearchOptions - options for quick search in RxDBGrid
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5324 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -118,9 +118,8 @@ type
|
|||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
//TRxDSState = (rxdsInactive, rxdsActive);
|
|
||||||
|
|
||||||
TRxFilterOpCode = (fopEQ, fopNotEQ, fopStartFrom, fopEndTo, fopLike, fopNotLike);
|
TRxFilterOpCode = (fopEQ, fopNotEQ, fopStartFrom, fopEndTo, fopLike, fopNotLike);
|
||||||
|
|
||||||
{ TRxDBGridKeyStroke }
|
{ TRxDBGridKeyStroke }
|
||||||
|
|
||||||
TRxDBGridKeyStroke = class(TCollectionItem)
|
TRxDBGridKeyStroke = class(TCollectionItem)
|
||||||
@ -162,6 +161,22 @@ type
|
|||||||
property Items[Index: integer]: TRxDBGridKeyStroke read GetItem write SetItem; default;
|
property Items[Index: integer]: TRxDBGridKeyStroke read GetItem write SetItem; default;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TRxDBGridSearchOptions }
|
||||||
|
|
||||||
|
TRxDBGridSearchOptions = class(TPersistent)
|
||||||
|
private
|
||||||
|
FFromStart: boolean;
|
||||||
|
FOwner:TRxDBGrid;
|
||||||
|
FQuickSearchOptions: TLocateOptions;
|
||||||
|
protected
|
||||||
|
procedure AssignTo(Dest: TPersistent); override;
|
||||||
|
public
|
||||||
|
constructor Create(AOwner: TRxDBGrid);
|
||||||
|
published
|
||||||
|
property QuickSearchOptions:TLocateOptions read FQuickSearchOptions write FQuickSearchOptions;
|
||||||
|
property FromStart:boolean read FFromStart write FFromStart;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TRxDBGridCollumnConstraint }
|
{ TRxDBGridCollumnConstraint }
|
||||||
|
|
||||||
TRxDBGridCollumnConstraints = class(TPersistent)
|
TRxDBGridCollumnConstraints = class(TPersistent)
|
||||||
@ -561,6 +576,7 @@ type
|
|||||||
FColumnDefValues: TRxDBGridColumnDefValues;
|
FColumnDefValues: TRxDBGridColumnDefValues;
|
||||||
//FrxDSState:TRxDSState;
|
//FrxDSState:TRxDSState;
|
||||||
FFooterOptions: TRxDBGridFooterOptions;
|
FFooterOptions: TRxDBGridFooterOptions;
|
||||||
|
FSearchOptions: TRxDBGridSearchOptions;
|
||||||
FSortColumns: TRxDbGridColumnsSortList;
|
FSortColumns: TRxDbGridColumnsSortList;
|
||||||
FSortingNow:Boolean;
|
FSortingNow:Boolean;
|
||||||
FInProcessCalc: integer;
|
FInProcessCalc: integer;
|
||||||
@ -635,6 +651,7 @@ type
|
|||||||
procedure SetKeyStrokes(const AValue: TRxDBGridKeyStrokes);
|
procedure SetKeyStrokes(const AValue: TRxDBGridKeyStrokes);
|
||||||
procedure SetOptionsRx(const AValue: TOptionsRx);
|
procedure SetOptionsRx(const AValue: TOptionsRx);
|
||||||
procedure SetPropertyStorage(const AValue: TCustomPropertyStorage);
|
procedure SetPropertyStorage(const AValue: TCustomPropertyStorage);
|
||||||
|
procedure SetSearchOptions(AValue: TRxDBGridSearchOptions);
|
||||||
procedure SetTitleButtons(const AValue: boolean);
|
procedure SetTitleButtons(const AValue: boolean);
|
||||||
procedure TrackButton(X, Y: integer);
|
procedure TrackButton(X, Y: integer);
|
||||||
function GetDrawFullLine: boolean;
|
function GetDrawFullLine: boolean;
|
||||||
@ -789,8 +806,6 @@ type
|
|||||||
property SortOrder:TSortMarker read GetSortOrder;
|
property SortOrder:TSortMarker read GetSortOrder;
|
||||||
|
|
||||||
property SortColumns:TRxDbGridColumnsSortList read FSortColumns;
|
property SortColumns:TRxDbGridColumnsSortList read FSortColumns;
|
||||||
//property MarkerUp : TBitmap read GetMarkerUp write SetMarkerUp;
|
|
||||||
//property MarkerDown : TBitmap read GetMarkerDown write SetMarkerDown;
|
|
||||||
published
|
published
|
||||||
property AfterQuickSearch: TRxQuickSearchNotifyEvent read FAfterQuickSearch write FAfterQuickSearch;
|
property AfterQuickSearch: TRxQuickSearchNotifyEvent read FAfterQuickSearch write FAfterQuickSearch;
|
||||||
property ColumnDefValues:TRxDBGridColumnDefValues read FColumnDefValues write SetColumnDefValues;
|
property ColumnDefValues:TRxDBGridColumnDefValues read FColumnDefValues write SetColumnDefValues;
|
||||||
@ -802,6 +817,7 @@ type
|
|||||||
property Columns: TRxDbGridColumns read GetColumns write SetColumns stored IsColumnsStored;
|
property Columns: TRxDbGridColumns read GetColumns write SetColumns stored IsColumnsStored;
|
||||||
property KeyStrokes: TRxDBGridKeyStrokes read FKeyStrokes write SetKeyStrokes;
|
property KeyStrokes: TRxDBGridKeyStrokes read FKeyStrokes write SetKeyStrokes;
|
||||||
property FooterOptions:TRxDBGridFooterOptions read FFooterOptions write SetFooterOptions;
|
property FooterOptions:TRxDBGridFooterOptions read FFooterOptions write SetFooterOptions;
|
||||||
|
property SearchOptions:TRxDBGridSearchOptions read FSearchOptions write SetSearchOptions;
|
||||||
|
|
||||||
//storage
|
//storage
|
||||||
property PropertyStorage: TCustomPropertyStorage read GetPropertyStorage write SetPropertyStorage;
|
property PropertyStorage: TCustomPropertyStorage read GetPropertyStorage write SetPropertyStorage;
|
||||||
@ -1055,6 +1071,27 @@ type
|
|||||||
procedure EditingDone; override;
|
procedure EditingDone; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TRxDBGridSearchOptions }
|
||||||
|
|
||||||
|
procedure TRxDBGridSearchOptions.AssignTo(Dest: TPersistent);
|
||||||
|
begin
|
||||||
|
if Dest is TRxDBGridSearchOptions then
|
||||||
|
begin
|
||||||
|
TRxDBGridSearchOptions(Dest).FQuickSearchOptions:=FQuickSearchOptions;
|
||||||
|
TRxDBGridSearchOptions(Dest).FFromStart:=FFromStart;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
inherited AssignTo(Dest);
|
||||||
|
end;
|
||||||
|
|
||||||
|
constructor TRxDBGridSearchOptions.Create(AOwner: TRxDBGrid);
|
||||||
|
begin
|
||||||
|
inherited Create;
|
||||||
|
FOwner:=AOwner;
|
||||||
|
FQuickSearchOptions:=[loPartialKey, loCaseInsensitive];
|
||||||
|
FFromStart:=false;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TRxDBGridColumnDefValues }
|
{ TRxDBGridColumnDefValues }
|
||||||
|
|
||||||
procedure TRxDBGridColumnDefValues.AssignTo(Dest: TPersistent);
|
procedure TRxDBGridColumnDefValues.AssignTo(Dest: TPersistent);
|
||||||
@ -2617,6 +2654,11 @@ begin
|
|||||||
FPropertyStorageLink.Storage := AValue;
|
FPropertyStorageLink.Storage := AValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TRxDBGrid.SetSearchOptions(AValue: TRxDBGridSearchOptions);
|
||||||
|
begin
|
||||||
|
FSearchOptions.Assign(AValue);
|
||||||
|
end;
|
||||||
|
|
||||||
function TRxDBGrid.DatalinkActive: boolean;
|
function TRxDBGrid.DatalinkActive: boolean;
|
||||||
begin
|
begin
|
||||||
Result := Assigned(DataSource) and Assigned(DataSource.DataSet) and
|
Result := Assigned(DataSource) and Assigned(DataSource.DataSet) and
|
||||||
@ -4372,7 +4414,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
//1.Вызываем процедурку поиска...
|
//1.Вызываем процедурку поиска...
|
||||||
if DataSetLocateThrough(Self.DataSource.DataSet,
|
if DataSetLocateThrough(Self.DataSource.DataSet,
|
||||||
Self.SelectedField.FieldName, AValue, [loPartialKey, loCaseInsensitive]) then
|
Self.SelectedField.FieldName, AValue, FSearchOptions.FQuickSearchOptions, rsdAll, FSearchOptions.FFromStart) then
|
||||||
Self.FQuickUTF8Search := AValue;
|
Self.FQuickUTF8Search := AValue;
|
||||||
ClearSearchValue := False;
|
ClearSearchValue := False;
|
||||||
end;
|
end;
|
||||||
@ -5630,6 +5672,7 @@ begin
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
FToolsList:=TFPList.Create;
|
FToolsList:=TFPList.Create;
|
||||||
FColumnDefValues:=TRxDBGridColumnDefValues.Create(Self);
|
FColumnDefValues:=TRxDBGridColumnDefValues.Create(Self);
|
||||||
|
FSearchOptions:=TRxDBGridSearchOptions.Create(Self);
|
||||||
|
|
||||||
FSortColumns:=TRxDbGridColumnsSortList.Create;
|
FSortColumns:=TRxDbGridColumnsSortList.Create;
|
||||||
|
|
||||||
@ -5681,29 +5724,19 @@ end;
|
|||||||
destructor TRxDBGrid.Destroy;
|
destructor TRxDBGrid.Destroy;
|
||||||
begin
|
begin
|
||||||
CleanDSEvent;
|
CleanDSEvent;
|
||||||
|
|
||||||
FreeAndNil(FFooterOptions);
|
FreeAndNil(FFooterOptions);
|
||||||
|
|
||||||
FreeAndNil(FRxDbGridLookupComboEditor);
|
FreeAndNil(FRxDbGridLookupComboEditor);
|
||||||
FreeAndNil(FRxDbGridDateEditor);
|
FreeAndNil(FRxDbGridDateEditor);
|
||||||
//FreeAndNil(FMarkerDown);
|
|
||||||
//FreeAndNil(FMarkerUp);
|
|
||||||
FreeAndNil(FPropertyStorageLink);
|
FreeAndNil(FPropertyStorageLink);
|
||||||
FreeAndNil(FFilterListEditor);
|
FreeAndNil(FFilterListEditor);
|
||||||
|
|
||||||
FreeAndNil(F_PopupMenu);
|
FreeAndNil(F_PopupMenu);
|
||||||
FreeAndNil(F_MenuBMP);
|
FreeAndNil(F_MenuBMP);
|
||||||
{ FreeAndNil(FEllipsisRxBMP);
|
|
||||||
FreeAndNil(FGlyphRxBMP);
|
|
||||||
FreeAndNil(FUpDownRxBMP);
|
|
||||||
FreeAndNil(FPlusRxBMP);
|
|
||||||
FreeAndNil(FMinusRxBMP);}
|
|
||||||
|
|
||||||
FreeAndNil(F_LastFilter);
|
FreeAndNil(F_LastFilter);
|
||||||
|
|
||||||
FreeAndNil(FKeyStrokes);
|
FreeAndNil(FKeyStrokes);
|
||||||
FreeAndNil(FToolsList);
|
FreeAndNil(FToolsList);
|
||||||
FreeAndNil(FColumnDefValues);
|
FreeAndNil(FColumnDefValues);
|
||||||
|
FreeAndNil(FSearchOptions);
|
||||||
|
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
FreeAndNil(FSortColumns);
|
FreeAndNil(FSortColumns);
|
||||||
end;
|
end;
|
||||||
|
@ -50,7 +50,6 @@ const
|
|||||||
|
|
||||||
type
|
type
|
||||||
TRxSearchDirection = (rsdAll, rsdForward, rsdBackward);
|
TRxSearchDirection = (rsdAll, rsdForward, rsdBackward);
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
{ TLocateObject }
|
{ TLocateObject }
|
||||||
@ -110,7 +109,7 @@ procedure InternalRestoreFields(DataSet: TDataSet; IniFile: TObject;
|
|||||||
const Section: string; RestoreVisible: Boolean);}
|
const Section: string; RestoreVisible: Boolean);}
|
||||||
|
|
||||||
function DataSetLocateThrough(DataSet: TDataSet; const KeyFields: string;
|
function DataSetLocateThrough(DataSet: TDataSet; const KeyFields: string;
|
||||||
const KeyValues: Variant; Options: TLocateOptions; SearchOrigin:TRxSearchDirection = rsdAll): Boolean;
|
const KeyValues: Variant; Options: TLocateOptions; SearchOrigin:TRxSearchDirection = rsdAll; ASearchFromStart:boolean = false): Boolean;
|
||||||
|
|
||||||
procedure SaveFieldsReg(DataSet: TDataSet; IniFile: TRegIniFile);
|
procedure SaveFieldsReg(DataSet: TDataSet; IniFile: TRegIniFile);
|
||||||
procedure RestoreFieldsReg(DataSet: TDataSet; IniFile: TRegIniFile;
|
procedure RestoreFieldsReg(DataSet: TDataSet; IniFile: TRegIniFile;
|
||||||
@ -384,7 +383,8 @@ end;
|
|||||||
|
|
||||||
{ DataSet locate routines }
|
{ DataSet locate routines }
|
||||||
function DataSetLocateThrough(DataSet: TDataSet; const KeyFields: string;
|
function DataSetLocateThrough(DataSet: TDataSet; const KeyFields: string;
|
||||||
const KeyValues: Variant; Options: TLocateOptions; SearchOrigin:TRxSearchDirection = rsdAll): Boolean;
|
const KeyValues: Variant; Options: TLocateOptions; SearchOrigin:TRxSearchDirection = rsdAll;
|
||||||
|
ASearchFromStart:boolean = false): Boolean;
|
||||||
var
|
var
|
||||||
FieldCount: Integer;
|
FieldCount: Integer;
|
||||||
Fields: TList;
|
Fields: TList;
|
||||||
@ -415,7 +415,15 @@ var
|
|||||||
Result := UTF8CompareStr(S, S1) = 0;}
|
Result := UTF8CompareStr(S, S1) = 0;}
|
||||||
|
|
||||||
if (loPartialKey in Options) then
|
if (loPartialKey in Options) then
|
||||||
|
begin
|
||||||
|
if ASearchFromStart then
|
||||||
|
begin
|
||||||
|
UTF8Delete(S, UTF8Length(S1) + 1, MaxInt);
|
||||||
|
Result := UTF8CompareStr(S, S1) = 0;
|
||||||
|
end
|
||||||
|
else
|
||||||
Result := UTF8Pos(S1, S) > 0
|
Result := UTF8Pos(S1, S) > 0
|
||||||
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
Result := UTF8CompareStr(S, S1) = 0;
|
Result := UTF8CompareStr(S, S1) = 0;
|
||||||
|
Reference in New Issue
Block a user