DBGrid OnEditButton Click
Bonjour,
Lorsque je fais un double-clique sur la cellule à modifier, le DBGrid appelle la procédure OnEditButtonClick
Il y a t'il possibilité de contourné sa
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| procedure TForm1.DBGridEditButtonClick(Sender: TObject);
var
XColIndex: Integer;
XFieldName: String;
begin
XColIndex := TDrawGrid(DBGrid).Col - 1;
if DBGrid.Columns[XColIndex].Field.DataType in [ftString] then
begin
XFieldName := DBGrid.Columns[XColIndex].Field.FieldName;
with TClientDataSet.Create(nil) do
begin
ReadOnly := True;
FileName := ClientDataSet1.FileName;
Active := True;
ListBox1.Items.BeginUpdate;
while not Eof do
begin
if ListBox1.Items.IndexOf(Fields.FieldByName(XFieldName).AsString) = -1 then
ListBox1.Items.Add(Fields.FieldByName(XFieldName).AsString);
Next;
end;
ListBox1.Items.EndUpdate;
Free; { TClientDataSet }
end;
end;
end; |
Merci