
+ in TRxCustomDBLookupCombo accelerated drawing data - In TRxCustomDBLookupCombo fix select first record if DataField is emty + In RxDBGrid are published missing events from DBGrid + New component TRxCalendarGrid - simple calendar without heading. - fix error compile module rxappicon.pas in Windows for GTK2 (thx ViruZ) + add new module rxiconv.pas (original module iconv.pas from A.Voito) + minor fix in drawing button caption in setup form TToolbar + fix draw disables state for TRxCustomDBLookupCombo - fix compile rxctrls in fpc 2.2 + TPopUpColumnTitle used define NEW_STYLE_TITLE_ALIGNMENT_RXDBGRID + in RxDBGrid images of markers moved to rxdbgrids.lrs (Petr Smolik) + add module for autosort in RxDBGrid exsortzeos.pas for ZeosDB (Petr Smolik) git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@276 8e941d3f-bd1b-0410-a28a-d453659cc2b4
115 lines
2.5 KiB
ObjectPascal
115 lines
2.5 KiB
ObjectPascal
unit rxdbgrid_findunit;
|
|
|
|
{$mode objfpc}{$H+}
|
|
|
|
interface
|
|
|
|
uses
|
|
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, Buttons,
|
|
StdCtrls, ExtCtrls, rxdbgrid, DB;
|
|
|
|
type
|
|
|
|
{ TrxDBGridFindForm }
|
|
|
|
TrxDBGridFindForm = class(TForm)
|
|
BtnFind: TButton;
|
|
Button2: TButton;
|
|
CheckBox1: TCheckBox;
|
|
CheckBox2: TCheckBox;
|
|
ComboBox1: TComboBox;
|
|
Edit1: TEdit;
|
|
Label1: TLabel;
|
|
Label2: TLabel;
|
|
RadioGroup1: TRadioGroup;
|
|
procedure BtnFindClick(Sender: TObject);
|
|
procedure Button2Click(Sender: TObject);
|
|
procedure FormActivate(Sender: TObject);
|
|
procedure FormShow(Sender: TObject);
|
|
private
|
|
FGrid:TRxDBGrid;
|
|
FDataSet:TDataSet;
|
|
procedure SetGrid(AGrid:TRxDBGrid);
|
|
public
|
|
{ public declarations }
|
|
end;
|
|
|
|
procedure ShowRxDBGridFindForm(Grid:TRxDBGrid);
|
|
|
|
implementation
|
|
uses dbutils, DBGrids;
|
|
|
|
procedure ShowRxDBGridFindForm(Grid: TRxDBGrid);
|
|
var
|
|
rxDBGridFindForm: TrxDBGridFindForm;
|
|
begin
|
|
rxDBGridFindForm:=TrxDBGridFindForm.Create(Application);
|
|
rxDBGridFindForm.SetGrid(Grid);
|
|
rxDBGridFindForm.ShowModal;
|
|
rxDBGridFindForm.Free;
|
|
end;
|
|
|
|
{ TrxDBGridFindForm }
|
|
|
|
procedure TrxDBGridFindForm.Button2Click(Sender: TObject);
|
|
begin
|
|
Close;
|
|
end;
|
|
|
|
procedure TrxDBGridFindForm.FormActivate(Sender: TObject);
|
|
begin
|
|
{ BtnFind.Height:=Canvas.TextHeight('W') + 6;
|
|
Button2.Height:=BtnFind.Height;}
|
|
ComboBox1.Height:=Edit1.Height;
|
|
end;
|
|
|
|
procedure TrxDBGridFindForm.FormShow(Sender: TObject);
|
|
begin
|
|
Edit1.SetFocus;
|
|
end;
|
|
|
|
procedure TrxDBGridFindForm.BtnFindClick(Sender: TObject);
|
|
var
|
|
FieldName:string;
|
|
LOptions: TLocateOptions;
|
|
begin
|
|
FieldName:=FGrid.Columns[ComboBox1.ItemIndex].FieldName;
|
|
LOptions:=[];
|
|
if not CheckBox1.Checked then
|
|
LOptions:=LOptions+[loCaseInsensitive];
|
|
|
|
if CheckBox2.Checked then
|
|
LOptions:=LOptions+[loPartialKey];
|
|
DataSetLocateThrough(FDataSet, FieldName, Edit1.Text, LOptions);
|
|
end;
|
|
|
|
type
|
|
THckGrid = class(TCustomDBGrid)
|
|
end;
|
|
|
|
procedure TrxDBGridFindForm.SetGrid(AGrid: TRxDBGrid);
|
|
var
|
|
i:integer;
|
|
begin
|
|
if AGrid=FGrid then exit;
|
|
FGrid:=AGrid;
|
|
ComboBox1.Items.Clear;
|
|
if Assigned(AGrid) then
|
|
begin
|
|
for i:=0 to AGrid.Columns.Count-1 do
|
|
ComboBox1.Items.Add(AGrid.Columns[i].Title.Caption);
|
|
ComboBox1.ItemIndex:=ComboBox1.Items.IndexOf(AGrid.SelectedColumn.Title.Caption);
|
|
end;
|
|
|
|
FDataSet:=nil;
|
|
if Assigned(FGrid) and Assigned(THckGrid(FGrid).DataSource) then
|
|
FDataSet:=THckGrid(FGrid).DataSource.DataSet;
|
|
BtnFind.Enabled:=Assigned(FDataSet) and FDataSet.Active
|
|
end;
|
|
|
|
initialization
|
|
{$I rxdbgrid_findunit.lrs}
|
|
|
|
end.
|
|
|