声明类:
Tmygrid =class(TCustomGrid);
procedure TForm1.DBGrid1ColExit(Sender: TObject);
begin
showmessage( Tmygrid(self.DBGrid1).InplaceEditor.Text );
end;
例如:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Mask, DBCtrls, DB, ADODB, Grids, DBGrids;
type
TForm1 = class(TForm)
ADOConnection1: TADOConnection;
ADODataSet1: TADODataSet;
DataSource1: TDataSource;
DBEdit1: TDBEdit;
Button1: TButton;
DBGrid1: TDBGrid;
DataSource2: TDataSource;
procedure DBEdit1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure DBGrid1ColExit(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
Tmygrid =class(TCustomGrid);
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.DBEdit1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
end;
procedure TForm1.DBGrid1ColExit(Sender: TObject);
begin
showmessage( Tmygrid(self.DBGrid1).InplaceEditor.Text );
end;
end.
高难度问题,分分吧
你可以看我的回答:
http://www.delphibbs.com/delphibbs/dispq.asp?lid=1155658