RxFPC:add filter to TSelectDataSetForm

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8874 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
alexs75
2023-07-04 11:51:39 +00:00
parent f94507c050
commit c1e6d2dca6
5 changed files with 56 additions and 24 deletions

View File

@ -37,7 +37,7 @@ interface
uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls,
Buttons, ComponentEditors, DB, ButtonPanel;
Buttons, ComponentEditors, ListFilterEdit, DB, ButtonPanel;
type
@ -48,6 +48,7 @@ type
CheckBox1: TCheckBox;
Label1: TLabel;
DataSetList: TListBox;
ListFilterEdit1: TListFilterEdit;
procedure CheckBox1Change(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure ListBox1DblClick(Sender: TObject);
@ -80,10 +81,10 @@ type
function SelectDataSet(ADesigner: TComponentEditorDesigner; const ACaption: string;
ExcludeDataSet: TDataSet): TDataSet;
{
var
SelectDataSetForm: TSelectDataSetForm;
}
implementation
uses rxmemds, rxdconst;
@ -138,8 +139,10 @@ var
Component, F: TComponent;
begin
DataSetList.Items.BeginUpdate;
ListFilterEdit1.Items.BeginUpdate;
try
DataSetList.Clear;
ListFilterEdit1.Items.Clear;
FExclude := '';
if ExcludeDataSet <> nil then FExclude := ExcludeDataSet.Name;
@ -168,21 +171,24 @@ begin
end;
end;
ListFilterEdit1.ResetFilter;
with DataSetList do
begin
if Items.Count > 0 then ItemIndex := 0;
Enabled := Items.Count > 0;
Enabled := ListFilterEdit1.Items.Count > 0;
ButtonPanel1.OKButton.Enabled:= (ItemIndex >= 0);
end;
finally
DataSetList.Items.EndUpdate;
ListFilterEdit1.Items.EndUpdate;
end;
end;
procedure TSelectDataSetForm.AddDataSet(const S: string; ADS: TDataSet);
begin
if (S <> '') and (S <> FExclude) then
DataSetList.Items.AddObject(S, ADS);
//DataSetList.Items.AddObject(S, ADS);
ListFilterEdit1.Items.AddObject(S, ADS);
end;
{ TMemDataSetEditor }