当前位置:Gxlcms >
数据库问题 >
How to create a OnCellDblClick for Delphi's TDBGrid
How to create a OnCellDblClick for Delphi's TDBGrid
时间:2021-07-01 10:21:17
帮助过:27人阅读
TForm1 =
class(TForm)
private
FEmptySpace : boolean;
...
procedure TForm1.DBGrid1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
// in my test I only get here when clicked on empty part of the dbgrid
FEmptySpace :=
TRUE;
end;
procedure TForm1.DBGrid1DblClick(Sender: TObject);
begin
if FEmptySpace
then
showmessage(‘clicked in the middle of nowhere...‘)
else
showmessage(DBGrid1.Fields[DBGrid1.SelectedField.Index].AsString);
FEmptySpace :=
FALSE;
end;
I have not tested this in all situations
In my test
Options.Editing := false
Options.dgRowSelect := false
Readonly := true
How to create a OnCellDblClick for Delphi's TDBGrid
标签:events int record col RoCE index eth situation mouse