Стартовый пул

This commit is contained in:
2024-04-02 08:46:59 +03:00
parent fd57fffd3a
commit 3bb34d000b
5591 changed files with 3291734 additions and 0 deletions

View File

@@ -0,0 +1,247 @@
{ rxFileUtils is part of RxFPC library
Copyright (C) 2005-2017 Lagunov Aleksey alexs@yandex.ru and Lazarus team
original conception from rx library for Delphi (c)
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version with the following modification:
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent modules,and
to copy and distribute the resulting executable under terms of your choice,
provided that you also meet, for each linked independent module, the terms
and conditions of the license of that module. An independent module is a
module which is not derived from or based on this library. If you modify
this library, you may extend this exception to your version of the library,
but you are not obligated to do so. If you do not wish to do so, delete this
exception statement from your version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
for more details.
You should have received a copy of the GNU Library General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
}
unit rxFileUtils;
{$I rx.inc}
interface
uses
SysUtils;
function GetFileOwnerUser(const SearchDomain, FileName:String):String;
procedure GetFileOwnerData(const SearchDomain, FileName:String;out UserName, DomainName:string);
function NormalizeDirectoryName(const DirName:string):string;
function GetUserName:string;
function IsValidFileNameChar(const AChar: Char): Boolean;inline;
function NormalizeFileName(const FileName:string; AReplaceChar:char = '_'):string; //funtion only for filename - without folder name
const
{$IFDEF WINDOWS}
FileNameDisabledChars = [#0 .. #31, '"', '*', '/', ':', '<', '>', '?', '\' , '|'];
{$ELSE}
FileNameDisabledChars = [#0 .. #31, '/', '~'];
{$ENDIF}
implementation
uses
strutils
{$IFDEF WINDOWS}
, Windows
{$ENDIF}
{$IFDEF LINUX}
, BaseUnix, users
{$ENDIF}
;
{$IF DEFINED(WINDOWS) AND NOT DEFINED(WINCE)}
function LStrError(const Ernum: Longint; const UseUTF8: Boolean = False): string;
const
MAX_ERROR = 1024;
var
Tmp: string;
TmpW: widestring;
begin
Result := ' [' + IntToStr(Ernum) + ']: ';
if USEUtf8 then begin
SetLength(TmpW, MAX_ERROR);
SetLength(TmpW, FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM or
FORMAT_MESSAGE_IGNORE_INSERTS or
FORMAT_MESSAGE_ARGUMENT_ARRAY,
nil, Ernum, 0, @TmpW[1], MAX_ERROR, nil));
Tmp := UTF8Encode(TmpW);
end else begin
SetLength(Tmp, MAX_ERROR);
SetLength(Tmp, FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM or
FORMAT_MESSAGE_IGNORE_INSERTS or
FORMAT_MESSAGE_ARGUMENT_ARRAY,
nil, Ernum, 0, @Tmp[1], MAX_ERROR, nil));
end;
if Length(Tmp) > 2 then
Delete(Tmp, Length(Tmp)-1, 2);
Result := Result + Tmp;
end;
procedure GetFileNameOwner(const SearchDomain, FileName: String; out UserName, DomainName: string);
var
RCode, RC1:WINBOOL;
SDSize:DWORD; // Size of security descriptor
FAccountName:PChar; // Account name
lngAccountLen:DWORD; // Length of account name
FDomainName:PChar; // Domain name
lngDomainLen:DWORD; // Length of domain name
ptrUse:SID_NAME_USE; // Pointer to SID_NAME_USE
ptrOwner:PSID;
P:PByteArray;
begin
ptrOwner:=nil;
SDSize:=0;
P:=nil;
UserName:='';
DomainName:='';
RCode := GetFileSecurity(PChar(FileName), OWNER_SECURITY_INFORMATION, nil, 0, @SDSize);
GetMem(P, SDSize);
FillChar(P^, SDSize, 0);
RCode := GetFileSecurity(PChar(FileName), OWNER_SECURITY_INFORMATION, Pointer(P), SDSize, @SDSize);
if not RCode then
raise Exception.Create(LStrError(GetLastError, true));
RCode := GetSecurityDescriptorOwner(Pointer(P), ptrOwner, @RC1);
if not RCode then
raise Exception.Create(LStrError(GetLastError, true));
lngAccountLen:=0;
lngDomainLen:=0;
RCode := LookupAccountSid(PChar(SearchDomain), ptrOwner, nil, lngAccountLen, nil, lngDomainLen, ptrUse);
//' Configure the strings' buffer sizes
GetMem(FAccountName, lngAccountLen);
FillChar(FAccountName^, lngAccountLen, 0);
GetMem(FDomainName, lngDomainLen);
FillChar(FDomainName^, lngDomainLen, 0);
RCode:=LookupAccountSid(PChar(SearchDomain), ptrOwner, FAccountName, lngAccountLen, FDomainName, lngDomainLen, ptrUse);
if not RCode then
raise Exception.Create(LStrError(GetLastError, true));
UserName:=FAccountName;
DomainName:=FDomainName;
Freemem(P, SDSize);
Freemem(FAccountName, lngAccountLen);
Freemem(FDomainName, lngDomainLen);
end;
{$ELSE}
{$ENDIF}
function GetFileOwnerUser(const SearchDomain, FileName: String): String;
var
S:string;
{$IFDEF LINUX}
FStat: stat;
{$ENDIF}
begin
Result:='';
{$IF DEFINED(WINDOWS) AND NOT DEFINED(WINCE)}
(* GetFileNameOwner(UTF8ToSys(SearchDomain), UTF8ToSys(FileName), Result, S);
Result:=UTF8Encode(Result);*)
GetFileNameOwner(SearchDomain, FileName, Result, S);
{$ENDIF}
{$IFDEF LINUX}
if FpStat(FileName, FStat) = 0 then
Result:=users.GetUserName(FStat.uid);
{$ENDIF}
end;
procedure GetFileOwnerData(const SearchDomain, FileName: String; out UserName,
DomainName: string);
{$IF DEFINED(WINDOWS) AND NOT DEFINED(WINCE)}
{$ENDIF}
{$IFDEF LINUX}
var
SR: stat;
{$ENDIF}
begin
UserName:='';
DomainName:='';
{$IF DEFINED(WINDOWS) AND NOT DEFINED(WINCE)}
{ GetFileNameOwner(UTF8ToSys(SearchDomain), UTF8ToSys(FileName), UserName, DomainName);
UserName:=UTF8Encode(UserName);
DomainName:=UTF8Encode(DomainName);}
GetFileNameOwner(SearchDomain, FileName, UserName, DomainName);
{$ENDIF}
{$IFDEF LINUX}
FpStat(FileName, SR);
UserName:=users.GetUserName(SR.uid);
if Pos('\', UserName) > 0 then
DomainName:=Copy2SymbDel(UserName, '\') //for unix samba WinBIND
else
DomainName:='';//IntToStr( SR.gid);
{$ENDIF}
end;
{replase any dir separators '\' or '/' to system directory separator }
function NormalizeDirectoryName(const DirName: string): string;
var
i:integer;
begin
Result:=DirName;
for i:=1 to Length(Result) do
if Result[i] in ['/', '\'] then
Result[i]:=DirectorySeparator;
end;
function GetUserName: string;
{$IF DEFINED(WINDOWS) AND NOT DEFINED(WINCE)}
var
A:array [0..256] of Char;
L:DWORD;
{$ENDIF}
begin
{$IF DEFINED(WINDOWS) AND NOT DEFINED(WINCE)}
FillChar(A, SizeOf(A), 0);
L:=SizeOf(A)-1;
if Windows.GetUserNameA(@A, L) then
begin
(* Result:=SysToUTF8(StrPas(@A)); *)
Result:=StrPas(@A);
end
else
(*Result:=GetEnvironmentVariableUTF8('USERNAME');*)
Result:=SysUtils.GetEnvironmentVariable('USERNAME');
{$ELSE}
Result:=GetEnvironmentVariable('USER');
{$ENDIF}
end;
function IsValidFileNameChar(const AChar: Char): Boolean;
begin
Result:=not (AChar in FileNameDisabledChars);
end;
function NormalizeFileName(const FileName: string; AReplaceChar:char = '_'): string;
var
i:integer;
begin
Result:=FileName;
for i:=1 to Length(Result) do
if not IsValidFileNameChar(Result[i]) then
Result[i]:=AReplaceChar;
end;
end.

View File

@@ -0,0 +1,805 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="11"/>
<General>
<Flags>
<LRSInOutputDirectory Value="False"/>
</Flags>
<MainUnit Value="0"/>
<Title Value="RxDBGrid demo"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<Icon Value="0"/>
</General>
<VersionInfo>
<UseVersionInfo Value="True"/>
<AutoIncrementBuild Value="True"/>
<MajorVersionNr Value="3"/>
<MinorVersionNr Value="4"/>
<RevisionNr Value="1"/>
<BuildNr Value="1"/>
<StringTable ProductName="Demo application from RXFPC library" LegalCopyright="Lagunov Aleksey, GPL 2" ProductVersion="3.1.1.0" FileDescription="Demo application from RXFPC library"/>
</VersionInfo>
<BuildModes Count="1">
<Item1 Name="default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<IgnoreBinaries Value="False"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<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>
<PackageName Value="rxdbgrid_export_spreadsheet"/>
</Item1>
<Item2>
<PackageName Value="rxdbgrid_print"/>
</Item2>
<Item3>
<PackageName Value="FCL"/>
<MinVersion Major="1" Valid="True"/>
</Item3>
<Item4>
<PackageName Value="LCL"/>
</Item4>
<Item5>
<PackageName Value="rxnew"/>
<MinVersion Major="1" Release="18" Build="56" Valid="True"/>
</Item5>
</RequiredPackages>
<Units Count="78">
<Unit0>
<Filename Value="RxDBGridDemo.lpr"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="-1"/>
<CursorPos Y="17"/>
<UsageCount Value="130"/>
</Unit0>
<Unit1>
<Filename Value="rxdbgridmainunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="RxDBGridMainForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="RxDBGridMainUnit"/>
<IsVisibleTab Value="True"/>
<TopLine Value="118"/>
<CursorPos X="50" Y="152"/>
<UsageCount Value="130"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit1>
<Unit2>
<Filename Value="../../rxdbgrid.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="2470"/>
<CursorPos X="72" Y="2503"/>
<UsageCount Value="10"/>
</Unit2>
<Unit3>
<Filename Value="../../rxdbgridexportspreadsheet.pas"/>
<UnitName Value="RxDBGridExportSpreadSheet"/>
<EditorIndex Value="-1"/>
<TopLine Value="74"/>
<CursorPos X="41" Y="91"/>
<UsageCount Value="9"/>
</Unit3>
<Unit4>
<Filename Value="../../rxdconst.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="100"/>
<CursorPos X="55" Y="121"/>
<UsageCount Value="9"/>
</Unit4>
<Unit5>
<Filename Value="../../rxautopanel.pas"/>
<UnitName Value="RxAutoPanel"/>
<EditorIndex Value="-1"/>
<TopLine Value="32"/>
<CursorPos X="74" Y="56"/>
<UsageCount Value="9"/>
</Unit5>
<Unit6>
<Filename Value="../../registerrx.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="156"/>
<CursorPos X="47" Y="184"/>
<UsageCount Value="9"/>
</Unit6>
<Unit7>
<Filename Value="../../rxpickdate.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="246"/>
<CursorPos Y="257"/>
<UsageCount Value="9"/>
</Unit7>
<Unit8>
<Filename Value="../../rxtooledit.pas"/>
<EditorIndex Value="-1"/>
<CursorPos X="3"/>
<UsageCount Value="9"/>
</Unit8>
<Unit9>
<Filename Value="../../rxdateutil.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="16"/>
<CursorPos X="16" Y="32"/>
<UsageCount Value="9"/>
</Unit9>
<Unit10>
<Filename Value="../../rxdbdateedit.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="97"/>
<CursorPos X="18" Y="32"/>
<UsageCount Value="9"/>
</Unit10>
<Unit11>
<Filename Value="../../rxdbutils.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="145"/>
<CursorPos X="53" Y="168"/>
<UsageCount Value="9"/>
</Unit11>
<Unit12>
<Filename Value="../../rxdaterangeeditunit.pas"/>
<UnitName Value="rxDateRangeEditUnit"/>
<EditorIndex Value="-1"/>
<TopLine Value="133"/>
<CursorPos X="8" Y="150"/>
<UsageCount Value="9"/>
</Unit12>
<Unit13>
<Filename Value="../../rxboxprocs.pas"/>
<EditorIndex Value="-1"/>
<UsageCount Value="9"/>
</Unit13>
<Unit14>
<Filename Value="../../rxfduallst.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="22"/>
<CursorPos X="16" Y="32"/>
<UsageCount Value="9"/>
</Unit14>
<Unit15>
<Filename Value="../../rxduallist.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="72"/>
<CursorPos X="35" Y="91"/>
<UsageCount Value="9"/>
</Unit15>
<Unit16>
<Filename Value="../../rxtbrsetup.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="74"/>
<CursorPos X="38" Y="93"/>
<UsageCount Value="9"/>
</Unit16>
<Unit17>
<Filename Value="../../rxceeditlookupfields.pas"/>
<UnitName Value="rxceEditLookupFields"/>
<EditorIndex Value="-1"/>
<TopLine Value="40"/>
<CursorPos X="9" Y="64"/>
<UsageCount Value="9"/>
</Unit17>
<Unit18>
<Filename Value="../../register_rxctrl.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="269"/>
<CursorPos X="24" Y="301"/>
<UsageCount Value="9"/>
</Unit18>
<Unit19>
<Filename Value="../../LazReport/rxlazreport.pas"/>
<UnitName Value="RxLazReport"/>
<EditorIndex Value="-1"/>
<CursorPos X="90" Y="7"/>
<UsageCount Value="9"/>
</Unit19>
<Unit20>
<Filename Value="../../LazReport/lrrxcontrols.pas"/>
<UnitName Value="lrRxControls"/>
<EditorIndex Value="-1"/>
<TopLine Value="122"/>
<CursorPos X="74" Y="139"/>
<UsageCount Value="9"/>
</Unit20>
<Unit21>
<Filename Value="../../rxvclutils.pas"/>
<EditorIndex Value="-1"/>
<UsageCount Value="9"/>
</Unit21>
<Unit22>
<Filename Value="../../rxctrls.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="819"/>
<CursorPos X="27" Y="824"/>
<UsageCount Value="9"/>
</Unit22>
<Unit23>
<Filename Value="../../rxtoolbar.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="272"/>
<CursorPos X="35" Y="281"/>
<UsageCount Value="9"/>
</Unit23>
<Unit24>
<Filename Value="../../rxswitch.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="136"/>
<CursorPos X="16" Y="157"/>
<UsageCount Value="9"/>
</Unit24>
<Unit25>
<Filename Value="../../rxdice.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="16"/>
<CursorPos X="49" Y="38"/>
<UsageCount Value="9"/>
</Unit25>
<Unit26>
<Filename Value="../../rxclock.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="166"/>
<CursorPos X="16" Y="181"/>
<UsageCount Value="9"/>
</Unit26>
<Unit27>
<Filename Value="../../rxspin.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="242"/>
<CursorPos X="13" Y="245"/>
<UsageCount Value="9"/>
</Unit27>
<Unit28>
<Filename Value="../../rxmdi.pas"/>
<UnitName Value="RxMDI"/>
<EditorIndex Value="-1"/>
<TopLine Value="134"/>
<CursorPos Y="160"/>
<UsageCount Value="9"/>
</Unit28>
<Unit29>
<Filename Value="../../rxpopupunit.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="233"/>
<CursorPos X="6" Y="250"/>
<UsageCount Value="9"/>
</Unit29>
<Unit30>
<Filename Value="../../rxlookup.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="13"/>
<CursorPos X="23" Y="41"/>
<UsageCount Value="9"/>
</Unit30>
<Unit31>
<Filename Value="../../rxdbctrls.pas"/>
<UnitName Value="RxDBCtrls"/>
<EditorIndex Value="-1"/>
<TopLine Value="187"/>
<CursorPos X="29" Y="215"/>
<UsageCount Value="9"/>
</Unit31>
<Unit32>
<Filename Value="../../rxdbgridexportpdf.pas"/>
<UnitName Value="RxDBGridExportPdf"/>
<EditorIndex Value="-1"/>
<TopLine Value="23"/>
<CursorPos X="38" Y="40"/>
<UsageCount Value="9"/>
</Unit32>
<Unit33>
<Filename Value="../../rxlogin.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="196"/>
<CursorPos X="47" Y="209"/>
<UsageCount Value="9"/>
</Unit33>
<Unit34>
<Filename Value="../../rxdbgridprintgrid.pas"/>
<UnitName Value="RxDBGridPrintGrid"/>
<EditorIndex Value="-1"/>
<TopLine Value="22"/>
<CursorPos X="24" Y="39"/>
<UsageCount Value="9"/>
</Unit34>
<Unit35>
<Filename Value="../../rxseldsfrm.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="61"/>
<CursorPos X="16" Y="32"/>
<UsageCount Value="9"/>
</Unit35>
<Unit36>
<Filename Value="../../registerrxdb.pas"/>
<UnitName Value="RegisterRxDB"/>
<EditorIndex Value="-1"/>
<TopLine Value="149"/>
<CursorPos X="19" Y="165"/>
<UsageCount Value="9"/>
</Unit36>
<Unit37>
<Filename Value="../../rxcurredit.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="113"/>
<CursorPos X="3" Y="130"/>
<UsageCount Value="9"/>
</Unit37>
<Unit38>
<Filename Value="../../rxdbcurredit.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="25"/>
<CursorPos X="18" Y="34"/>
<UsageCount Value="9"/>
</Unit38>
<Unit39>
<Filename Value="../../rxfolderlister.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="13"/>
<CursorPos X="20" Y="32"/>
<UsageCount Value="9"/>
</Unit39>
<Unit40>
<Filename Value="../../rxpagemngr.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="26"/>
<CursorPos X="74" Y="49"/>
<UsageCount Value="9"/>
</Unit40>
<Unit41>
<Filename Value="../../rxdbgrid_findunit.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="55"/>
<CursorPos X="8" Y="72"/>
<UsageCount Value="9"/>
</Unit41>
<Unit42>
<Filename Value="../../rxdbspinedit.pas"/>
<UnitName Value="RxDBSpinEdit"/>
<EditorIndex Value="-1"/>
<TopLine Value="115"/>
<CursorPos X="8" Y="132"/>
<UsageCount Value="9"/>
</Unit42>
<Unit43>
<Filename Value="../../rxdbtimeedit.pas"/>
<UnitName Value="RxDBTimeEdit"/>
<EditorIndex Value="-1"/>
<TopLine Value="125"/>
<CursorPos X="8" Y="142"/>
<UsageCount Value="9"/>
</Unit43>
<Unit44>
<Filename Value="../../rxmemds.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="247"/>
<CursorPos X="36" Y="264"/>
<UsageCount Value="9"/>
</Unit44>
<Unit45>
<Filename Value="../../rxdbcomb.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="156"/>
<CursorPos X="8" Y="173"/>
<UsageCount Value="9"/>
</Unit45>
<Unit46>
<Filename Value="../../rxdbgridfootertools_setup.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="52"/>
<CursorPos X="8" Y="69"/>
<UsageCount Value="9"/>
</Unit46>
<Unit47>
<Filename Value="../../rxxpman.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="14"/>
<CursorPos X="6" Y="56"/>
<UsageCount Value="9"/>
</Unit47>
<Unit48>
<Filename Value="../../rxdb/rxdbgrid.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="6230"/>
<CursorPos X="8" Y="6265"/>
<UsageCount Value="15"/>
</Unit48>
<Unit49>
<Filename Value="../../../../lcl/grids.pas"/>
<UnitName Value="Grids"/>
<EditorIndex Value="-1"/>
<TopLine Value="8729"/>
<CursorPos X="3" Y="8733"/>
<UsageCount Value="11"/>
</Unit49>
<Unit50>
<Filename Value="../../../../lcl/controls.pp"/>
<UnitName Value="Controls"/>
<EditorIndex Value="-1"/>
<TopLine Value="2284"/>
<CursorPos X="15" Y="2303"/>
<UsageCount Value="10"/>
</Unit50>
<Unit51>
<Filename Value="../../../../lcl/include/customcontrol.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="64"/>
<CursorPos X="3" Y="73"/>
<UsageCount Value="10"/>
</Unit51>
<Unit52>
<Filename Value="../../../../lcl/dbgrids.pas"/>
<UnitName Value="DBGrids"/>
<EditorIndex Value="-1"/>
<TopLine Value="409"/>
<CursorPos X="15" Y="426"/>
<UsageCount Value="12"/>
</Unit52>
<Unit53>
<Filename Value="/home/install/source/fpcsrc/packages/fcl-db/src/base/db.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="1652"/>
<CursorPos X="14" Y="1665"/>
<UsageCount Value="11"/>
</Unit53>
<Unit54>
<Filename Value="../../rxdb/rxdbgrid_findunit.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="13"/>
<UsageCount Value="9"/>
</Unit54>
<Unit55>
<Filename Value="../../../../lcl/themes.pas"/>
<UnitName Value="Themes"/>
<EditorIndex Value="-1"/>
<TopLine Value="679"/>
<CursorPos X="27" Y="692"/>
<UsageCount Value="10"/>
</Unit55>
<Unit56>
<Filename Value="../../rx.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="23"/>
<CursorPos Y="60"/>
<UsageCount Value="12"/>
</Unit56>
<Unit57>
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
<EditorIndex Value="1"/>
<TopLine Value="1180"/>
<CursorPos X="45" Y="1192"/>
<UsageCount Value="12"/>
<Bookmarks Count="2">
<Item0 X="3" Y="7325" ID="1"/>
<Item1 X="17" Y="4367" ID="2"/>
</Bookmarks>
<Loaded Value="True"/>
</Unit57>
<Unit58>
<Filename Value="../../../rxdb/rxmemds.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="1077"/>
<CursorPos X="51" Y="1090"/>
<UsageCount Value="11"/>
</Unit58>
<Unit59>
<Filename Value="/home/install/source/fpcsrc/packages/fcl-db/src/base/bufdataset_parser.pp"/>
<EditorIndex Value="-1"/>
<TopLine Value="38"/>
<CursorPos Y="39"/>
<UsageCount Value="11"/>
</Unit59>
<Unit60>
<Filename Value="/home/install/source/fpcsrc/packages/fcl-db/src/base/dataset.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="1452"/>
<CursorPos X="3" Y="1457"/>
<UsageCount Value="10"/>
</Unit60>
<Unit61>
<Filename Value="../../../rxdb/rxdbgrid_popupfilterunit.pas"/>
<ComponentName Value="RxDBGrid_PopUpFilterForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="RxDBGrid_PopUpFilterUnit"/>
<EditorIndex Value="7"/>
<TopLine Value="152"/>
<CursorPos Y="159"/>
<UsageCount Value="11"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit61>
<Unit62>
<Filename Value="../../../rxtools/rxfileutils.pas"/>
<UnitName Value="rxFileUtils"/>
<EditorIndex Value="-1"/>
<TopLine Value="183"/>
<CursorPos Y="206"/>
<UsageCount Value="10"/>
</Unit62>
<Unit63>
<Filename Value="../../../../lazutils/translations.pas"/>
<UnitName Value="Translations"/>
<EditorIndex Value="-1"/>
<TopLine Value="604"/>
<CursorPos Y="635"/>
<UsageCount Value="10"/>
</Unit63>
<Unit64>
<Filename Value="../../../rxtools/rxdconst.pas"/>
<EditorIndex Value="5"/>
<TopLine Value="98"/>
<CursorPos X="3" Y="117"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit64>
<Unit65>
<Filename Value="/home/install/source/fpcsrc/rtl/inc/typshrdh.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="126"/>
<CursorPos X="17" Y="154"/>
<UsageCount Value="11"/>
</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>
<Unit67>
<Filename Value="../../../../../lcl/lclproc.pas"/>
<UnitName Value="LCLProc"/>
<EditorIndex Value="6"/>
<TopLine Value="843"/>
<CursorPos Y="862"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit67>
<Unit68>
<Filename Value="../../../../lazutils/laz_avl_tree.pp"/>
<UnitName Value="Laz_AVL_Tree"/>
<EditorIndex Value="-1"/>
<TopLine Value="1387"/>
<CursorPos Y="1406"/>
<UsageCount Value="10"/>
</Unit68>
<Unit69>
<Filename Value="../../../../../lcl/include/customcombobox.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="200"/>
<CursorPos Y="218"/>
<UsageCount Value="10"/>
</Unit69>
<Unit70>
<Filename Value="../../../../../lcl/lclmessageglue.pas"/>
<UnitName Value="LCLMessageGlue"/>
<EditorIndex Value="-1"/>
<TopLine Value="103"/>
<CursorPos Y="123"/>
<UsageCount Value="10"/>
</Unit70>
<Unit71>
<Filename Value="../../../../../lcl/interfaces/win32/win32callback.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="2676"/>
<CursorPos Y="2695"/>
<UsageCount Value="10"/>
</Unit71>
<Unit72>
<Filename Value="../../../../../lcl/interfaces/win32/win32wsstdctrls.pp"/>
<UnitName Value="Win32WSStdCtrls"/>
<EditorIndex Value="-1"/>
<TopLine Value="412"/>
<CursorPos Y="428"/>
<UsageCount Value="10"/>
</Unit72>
<Unit73>
<Filename Value="../../../../../lcl/interfaces/win32/win32memostrings.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="167"/>
<CursorPos X="42" Y="192"/>
<UsageCount Value="10"/>
</Unit73>
<Unit74>
<Filename Value="../../../../../lcl/include/control.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="4514"/>
<CursorPos Y="4540"/>
<UsageCount Value="10"/>
</Unit74>
<Unit75>
<Filename Value="../../../rxdbgrid_print/rxdbgridprintgrid.pas"/>
<UnitName Value="RxDBGridPrintGrid"/>
<EditorIndex Value="3"/>
<TopLine Value="365"/>
<CursorPos X="3" Y="314"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit75>
<Unit76>
<Filename Value="../../../rxdbgrid_export_spreadsheet/rxdbgridexportspreadsheet.pas"/>
<UnitName Value="RxDBGridExportSpreadSheet"/>
<EditorIndex Value="4"/>
<TopLine Value="40"/>
<CursorPos X="3" Y="59"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit76>
<Unit77>
<Filename Value="../../../rxdb/rxlookup.pas"/>
<EditorIndex Value="2"/>
<TopLine Value="34"/>
<CursorPos X="53" Y="54"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit77>
</Units>
<JumpHistory Count="30" HistoryIndex="29">
<Position1>
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
<Caret Line="1182" Column="61" TopLine="1151"/>
</Position1>
<Position2>
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
<Caret Line="2340" Column="3" TopLine="2338"/>
</Position2>
<Position3>
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
<Caret Line="1182" Column="15" TopLine="1164"/>
</Position3>
<Position4>
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
<Caret Line="1162" Column="15" TopLine="1143"/>
</Position4>
<Position5>
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
<Caret Line="2341" Column="3" TopLine="2338"/>
</Position5>
<Position6>
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
<Caret Line="1161" Column="15" TopLine="1101"/>
</Position6>
<Position7>
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
<Caret Line="1269" TopLine="1241"/>
</Position7>
<Position8>
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
<Caret Line="3023" Column="13" TopLine="3017"/>
</Position8>
<Position9>
<Filename Value="../../../rxdb/rxlookup.pas"/>
<Caret Line="322" Column="14" TopLine="305"/>
</Position9>
<Position10>
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
<Caret Line="3023" Column="26" TopLine="3017"/>
</Position10>
<Position11>
<Filename Value="../../../rxdb/rxdbgrid.pas"/>
<Caret Line="1192" Column="45" TopLine="1180"/>
</Position11>
<Position12>
<Filename Value="../../../rxdb/rxdbgrid_popupfilterunit.pas"/>
</Position12>
<Position13>
<Filename Value="../../../rxdb/rxdbgrid_popupfilterunit.pas"/>
<Caret Line="80" Column="27" TopLine="50"/>
</Position13>
<Position14>
<Filename Value="../../../rxdb/rxdbgrid_popupfilterunit.pas"/>
<Caret Line="162" TopLine="153"/>
</Position14>
<Position15>
<Filename Value="../../../rxdb/rxdbgrid_popupfilterunit.pas"/>
<Caret Line="159" TopLine="152"/>
</Position15>
<Position16>
<Filename Value="../../../rxdb/rxdbgrid_popupfilterunit.pas"/>
<Caret Line="160" TopLine="152"/>
</Position16>
<Position17>
<Filename Value="../../../rxdb/rxdbgrid_popupfilterunit.pas"/>
<Caret Line="161" TopLine="152"/>
</Position17>
<Position18>
<Filename Value="../../../rxdb/rxdbgrid_popupfilterunit.pas"/>
<Caret Line="163" TopLine="152"/>
</Position18>
<Position19>
<Filename Value="../../../rxdb/rxdbgrid_popupfilterunit.pas"/>
<Caret Line="164" TopLine="152"/>
</Position19>
<Position20>
<Filename Value="../../../rxdb/rxdbgrid_popupfilterunit.pas"/>
<Caret Line="166" TopLine="152"/>
</Position20>
<Position21>
<Filename Value="../../../rxdb/rxdbgrid_popupfilterunit.pas"/>
<Caret Line="165" Column="2" TopLine="152"/>
</Position21>
<Position22>
<Filename Value="../../../rxdb/rxdbgrid_popupfilterunit.pas"/>
<Caret Line="159" TopLine="152"/>
</Position22>
<Position23>
<Filename Value="../../../rxdb/rxdbgrid_popupfilterunit.pas"/>
<Caret Line="160" TopLine="152"/>
</Position23>
<Position24>
<Filename Value="../../../rxdb/rxdbgrid_popupfilterunit.pas"/>
<Caret Line="161" TopLine="152"/>
</Position24>
<Position25>
<Filename Value="../../../rxdb/rxdbgrid_popupfilterunit.pas"/>
<Caret Line="166" TopLine="152"/>
</Position25>
<Position26>
<Filename Value="../../../rxdb/rxdbgrid_popupfilterunit.pas"/>
<Caret Line="169" Column="4" TopLine="152"/>
</Position26>
<Position27>
<Filename Value="../../../rxdb/rxdbgrid_popupfilterunit.pas"/>
<Caret Line="159" TopLine="152"/>
</Position27>
<Position28>
<Filename Value="../../../rxdb/rxdbgrid_popupfilterunit.pas"/>
<Caret Line="160" TopLine="152"/>
</Position28>
<Position29>
<Filename Value="../../../rxdb/rxdbgrid_popupfilterunit.pas"/>
<Caret Line="161" TopLine="152"/>
</Position29>
<Position30>
<Filename Value="../../../rxdb/rxdbgrid_popupfilterunit.pas"/>
<Caret Line="166" TopLine="152"/>
</Position30>
</JumpHistory>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<Target>
<Filename Value="RxDBGridDemo"/>
</Target>
<SearchPaths>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
<SrcPath Value="$(LazarusDir)/lcl;$(LazarusDir)/lcl/interfaces/$(LCLWidgetType)"/>
</SearchPaths>
<Parsing>
<SyntaxOptions>
<UseAnsiStrings Value="False"/>
</SyntaxOptions>
</Parsing>
<Linking>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
</CompilerOptions>
<Debugging>
<Exceptions Count="2">
<Item1>
<Name Value="RunError(216)"/>
</Item1>
<Item2>
<Name Value="EConvertError"/>
</Item2>
</Exceptions>
</Debugging>
</CONFIG>

Binary file not shown.

After

Width:  |  Height:  |  Size: 335 B

View File

@@ -0,0 +1,408 @@
{ rxfilterby unit
Copyright (C) 2005-2017 Lagunov Aleksey alexs75@yandex.ru and Lazarus team
original conception from rx library for Delphi (c)
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version with the following modification:
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent modules,and
to copy and distribute the resulting executable under terms of your choice,
provided that you also meet, for each linked independent module, the terms
and conditions of the license of that module. An independent module is a
module which is not derived from or based on this library. If you modify
this library, you may extend this exception to your version of the library,
but you are not obligated to do so. If you do not wish to do so, delete this
exception statement from your version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
for more details.
You should have received a copy of the GNU Library General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
}
unit rxfilterby;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, rxdbgrid, LResources, Forms, Controls, Graphics,
Dialogs, StdCtrls, db;
type
{ TrxFilterByForm }
TrxFilterByForm = class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
ComboBox1: TComboBox;
ComboBox10: TComboBox;
ComboBox11: TComboBox;
ComboBox12: TComboBox;
ComboBox13: TComboBox;
ComboBox14: TComboBox;
ComboBox15: TComboBox;
ComboBox16: TComboBox;
ComboBox17: TComboBox;
ComboBox18: TComboBox;
ComboBox19: TComboBox;
ComboBox2: TComboBox;
ComboBox20: TComboBox;
ComboBox21: TComboBox;
ComboBox22: TComboBox;
ComboBox23: TComboBox;
ComboBox24: TComboBox;
ComboBox25: TComboBox;
ComboBox26: TComboBox;
ComboBox27: TComboBox;
ComboBox3: TComboBox;
ComboBox4: TComboBox;
ComboBox5: TComboBox;
ComboBox6: TComboBox;
ComboBox7: TComboBox;
ComboBox8: TComboBox;
ComboBox9: TComboBox;
Edit1: TComboBox;
Edit2: TComboBox;
Edit3: TComboBox;
Edit4: TComboBox;
Edit5: TComboBox;
Edit6: TComboBox;
Edit7: TComboBox;
Edit8: TComboBox;
Edit9: TComboBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure ComboBoxChange(Sender: TObject);
procedure EditChange(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
Combo_1 : Array[1..9] of TComboBox;
Combo_2 : Array[1..9] of TComboBox;
Edit_1 : Array[1..9] of TComboBox;
Combo_3 : Array[1..9] of TComboBox;
FGrid : TRxDBGrid;
procedure ClearALL(AGrid : TRxDBGrid);
function FindCombo(CB:TComboBox):Integer;
function FindEdit(ED: TComboBox): Integer;
public
function Execute(AGrid : TRxDBGrid; var FilterStr : String; var LastFilter : TstringList):Boolean;
end;
var
rxFilterByForm: TrxFilterByForm;
implementation
uses rxdconst, rxstrutils, DBGrids;
{$R *.lfm}
{ TrxFilterByForm }
procedure TrxFilterByForm.Button2Click(Sender: TObject);
begin
ModalResult := mrCancel;
end;
procedure TrxFilterByForm.Button3Click(Sender: TObject);
begin
ClearALL(FGrid);
end;
procedure TrxFilterByForm.ComboBoxChange(Sender: TObject);
var
CBN : Integer;
CB : TComboBox;
begin
CB := (Sender AS TComboBox);
CBN := FindCombo(CB);
if CBN=0 Then Exit;
if (CB.Text=' IS NULL ') Or (CB.Text=' IS NOT NULL ') Then
begin
Edit_1[CBN].Text := '';
Edit_1[CBN].Enabled := False;
Edit_1[CBN].Color := clInactiveCaption;
end
else
begin
Edit_1[CBN].Enabled := True;
Edit_1[CBN].Color := clWindow;
end;
end;
procedure TrxFilterByForm.EditChange(Sender: TObject);
var
EDN : Integer;
ED : TComboBox;
begin
ED := (Sender AS TComboBox);
EDN := FindEdit(ED);
if EDN=0 Then Exit;
if ED.Text='' Then Combo_1[EDN].ItemIndex:=-1;
end;
procedure TrxFilterByForm.FormCreate(Sender: TObject);
begin
Label1.Caption:=sRxFilterFormSelectExp;
Label2.Caption:=sRxFilterFormOnField;
Label3.Caption:=sRxFilterFormOperaion;
Label4.Caption:=sRxFilterFormCondition;
Label5.Caption:=sRxFilterFormOperand;
Label6.Caption:=sRxFilterFormEnd;
Button3.Caption:=sRxFilterFormClear;
Button2.Caption:=sRxFilterFormCancel;
Button1.Caption:=sRxFilterFormApply;
end;
procedure TrxFilterByForm.Button1Click(Sender: TObject);
begin
ModalResult := mrOK;
end;
procedure TrxFilterByForm.ClearALL(AGrid: TRxDBGrid);
var
i , wsb, w, wt: Integer;
begin
//*****************************************************************************
Combo_1[1].Items.Clear;
Combo_1[1].Items.Add('');
wsb:= 30; //ширина скроллбара
w := Combo_1[1].Width - wsb;
for i := 0 To AGrid.Columns.Count-1 do
begin
if Assigned(AGrid.Columns[i].Field) and (AGrid.Columns[i].Field.FieldKind=fkData) and (AGrid.Columns[i].Visible) then
begin
Combo_1[1].Items.AddObject(AGrid.Columns[i].Title.Caption, AGrid.Columns[i].Field);
Edit_1[1].Items.AddObject(AGrid.Columns[i].Title.Caption, AGrid.Columns[i].Field);
wt := Canvas.TextWidth(AGrid.Columns[i].Title.Caption);
if wt > w then
w := wt;
end;
end;
Combo_1[1].ItemIndex := 0;
Combo_1[1].ItemWidth := w + wsb;
for i := 2 To 9 do
begin
Combo_1[i].Items.Assign(Combo_1[1].Items);
Combo_1[i].ItemIndex := 0;
Combo_1[i].ItemWidth := w + wsb;
end;
Combo_2[1].Items.Clear;
Combo_2[1].Items.Add(' = ');
Combo_2[1].Items.Add(' > ');
Combo_2[1].Items.Add(' < ');
Combo_2[1].Items.Add(' >= ');
Combo_2[1].Items.Add(' <= ');
Combo_2[1].Items.Add(' <> ');
Combo_2[1].Items.Add(' LIKE ');
Combo_2[1].Items.Add(' IS NULL ');
Combo_2[1].Items.Add(' IS NOT NULL ');
Combo_2[1].ItemIndex := 0;
for i := 2 To 9 do
begin
Combo_2[i].Items.Assign(Combo_2[1].Items);
Combo_2[i].ItemIndex := 0;
end;
for i := 1 To 9 do
begin
Combo_3[i].ItemIndex := 0;
end;
for i := 1 To 9 do Edit_1[i].Text := '';
//*****************************************************************************
end;
function TrxFilterByForm.Execute(AGrid: TRxDBGrid; var FilterStr: String;
var LastFilter: TstringList): Boolean;
var
X : Integer;
P : Integer;
S, S1 : String;
SD : String;
C : TColumn;
C1: TRxColumn;
begin
Result := False;
//*****************************************************************************
Combo_1[1]:= ComboBox1;
Combo_1[2]:= ComboBox4;
Combo_1[3]:= ComboBox7;
Combo_1[4]:= ComboBox10;
Combo_1[5]:= ComboBox13;
Combo_1[6]:= ComboBox16;
Combo_1[7]:= ComboBox19;
Combo_1[8]:= ComboBox22;
Combo_1[9]:= ComboBox25;
Combo_2[1]:= ComboBox2;
Combo_2[2]:= ComboBox5;
Combo_2[3]:= ComboBox8;
Combo_2[4]:= ComboBox11;
Combo_2[5]:= ComboBox14;
Combo_2[6]:= ComboBox17;
Combo_2[7]:= ComboBox20;
Combo_2[8]:= ComboBox23;
Combo_2[9]:= ComboBox26;
Combo_3[1]:= ComboBox3;
Combo_3[2]:= ComboBox6;
Combo_3[3]:= ComboBox9;
Combo_3[4]:= ComboBox12;
Combo_3[5]:= ComboBox15;
Combo_3[6]:= ComboBox18;
Combo_3[7]:= ComboBox21;
Combo_3[8]:= ComboBox24;
Combo_3[9]:= ComboBox27;
Combo_3[9].Visible := False;
Edit_1[1] := Edit1;
Edit_1[2] := Edit2;
Edit_1[3] := Edit3;
Edit_1[4] := Edit4;
Edit_1[5] := Edit5;
Edit_1[6] := Edit6;
Edit_1[7] := Edit7;
Edit_1[8] := Edit8;
Edit_1[9] := Edit9;
//*****************************************************************************
FGrid := AGrid;
ClearALL(FGrid);
if LastFilter.Count > 0 Then
begin
for X := 0 To LastFilter.Count-1 do
begin
S := LastFilter.Strings[X];
P := Pos('|||',S);
if P > 0 Then
begin
S1:=System.Copy(S,1,P-1);
C:=FGrid.ColumnByFieldName(S1);
Combo_1[X+1].ItemIndex := Combo_1[X+1].Items.IndexOf(C.Title.Caption);
System.Delete(S,1,P+2);
end;
P := Pos('|||',S);
if P > 0 Then
begin
SD:=System.Copy(S,1,P-1);
Combo_2[X+1].ItemIndex := Combo_2[X+1].Items.IndexOf(System.Copy(S,1,P-1));
System.Delete(S,1,P+2);
if (SD=' IS NULL ') or (SD=' IS NOT NULL ') Then
Begin
Edit_1[X+1].Text:= '';
Edit_1[X+1].Enabled := False;
Edit_1[X+1].Color := clInactiveCaption;
End;
end;
P := Pos('|||',S);
if P > 0 then
begin
Edit_1[X+1].Text := System.Copy(S,1,P-1);
System.Delete(S,1,P+2);
end;
Combo_3[X+1].ItemIndex := Combo_3[X+1].Items.IndexOf(S);
if Combo_3[X+1].ItemIndex = -1 Then Combo_3[X+1].ItemIndex := 0;
end;
end;
if ShowModal = mrOK Then
begin
Result := True;
FilterStr := '';
LastFilter.Clear;
for X := 1 to 9 Do
begin
if (Combo_1[X].Text <> '') and (Combo_2[X].Text <> '') then
begin
if (Edit_1[X].Enabled=False) or (Edit_1[X].Text <> '') Then
begin
if X>1 Then
FilterStr := FilterStr+Combo_3[X-1].Text+' ';
C:=FGrid.ColumnByCaption(Combo_1[X].Text);
if Edit_1[X].Items.IndexOf(Edit_1[X].Text)>-1 then
begin
C1:=FGrid.ColumnByCaption(Edit_1[X].Text);
FilterStr := FilterStr+'('+C.FieldName+Combo_2[X].Text+C1.FieldName+') ';
end
else
if Pos('NULL', Combo_2[X].Text) > 0 then
FilterStr := FilterStr+'('+C.FieldName+Combo_2[X].Text+') '
else
case C.Field.DataType of
ftDateTime ,
ftDate : FilterStr := FilterStr+'('+C.FieldName+Combo_2[X].Text+Char(39)+Copy(Edit_1[X].Text,7,4)+Copy(Edit_1[X].Text,3,4)+Copy(Edit_1[X].Text,1,2)+Copy(Edit_1[X].Text,11,9)+Char(39)+') ';
ftUnknown : FilterStr := FilterStr+'('+C.FieldName+Combo_2[X].Text+Edit_1[X].Text+') ';
ftTime,
ftString,
ftMemo : FilterStr := FilterStr+'('+C.FieldName+Combo_2[X].Text+QuotedString(Edit_1[X].Text, '''')+') ';
else
FilterStr := FilterStr+'('+C.FieldName+Combo_2[X].Text+Edit_1[X].Text+') ';
end;
LastFilter.Add(C.FieldName+'|||'+Combo_2[X].Text+'|||'+Edit_1[X].Text+'|||'+Combo_3[X].Text);
end;
end;
end;
end;
end;
Function TrxFilterByForm.FindCombo(CB:TComboBox):Integer;
var
X : Integer;
begin
Result :=0;
for X := 1 to 9 do
begin
if Combo_2[X]=CB Then
begin
Result := X;
Exit;
end;
end;
end;
function TrxFilterByForm.FindEdit(ED:TComboBox):Integer;
var
X : Integer;
begin
Result :=0;
for X := 1 to 9 do
begin
if Edit_1[X]=ED then
begin
Result := X;
Exit;
end;
end;
end;
end.