AdtForm.pas
资源名称:delphi.rar [点击查看]
上传用户:fh681027
上传日期:2022-07-23
资源大小:1959k
文件大小:1k
源码类别:
Delphi控件源码
开发平台:
Delphi
- unit AdtForm;
- interface
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- Db, DBClient, Grids, DBGrids, MidasLib;
- type
- TForm1 = class(TForm)
- ClientDataSet1: TClientDataSet;
- DataSource1: TDataSource;
- DBGrid1: TDBGrid;
- ClientDataSet1ID: TIntegerField;
- ClientDataSet1Name: TADTField;
- ClientDataSet1NameLastName: TStringField;
- ClientDataSet1NameFirstName: TStringField;
- procedure ClientDataSet1NameGetText(Sender: TField; var Text: String;
- DisplayText: Boolean);
- procedure DBGrid1TitleClick(Column: TColumn);
- procedure FormCreate(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- Form1: TForm1;
- implementation
- {$R *.DFM}
- procedure TForm1.ClientDataSet1NameGetText(Sender: TField;
- var Text: String; DisplayText: Boolean);
- begin
- Text := ClientDataSet1NameFirstName.AsString + ' ' +
- ClientDataSet1NameLastName.AsString;
- end;
- procedure TForm1.DBGrid1TitleClick(Column: TColumn);
- begin
- if Column.Field.FullName = 'Name' then
- ClientDataSet1.IndexFieldNames := 'Name.LastName'
- else
- ClientDataSet1.IndexFieldNames := Column.Field.FullName;
- end;
- procedure TForm1.FormCreate(Sender: TObject);
- begin
- ClientDataSet1.LogChanges := False;
- end;
- end.