When I call a validation as the example below, the event is in OnSetTex (or other as OnColExit), to abort (the typed keyboard Tab) the system should stop and this does not occur. I understand this as a bug.
In a test with rxDBGrid, it works correctly. The reason I'm posting this message to you is for those who use dbgrid like me who have tried to remedy this instance without success. The problem of using rxDBGrid
weighs once it is not adopted as standard by Lazarus.
example
in Design mode I created two strings fields (codigo and nome) in bufdataset
and I put two grids on the form (dbgrid and rxdbgrid), and one for button
switch between editing the dbgrid and rxdbgrid.
By entering the value "1" in the codigo field and press the tab key
in dbgrid after abort is run a second time. In this rxDbgrid
It does not occur.
procedure TForm1.FormCreate(Sender: TObject);
begin
bufdataset1.CreateDataset ;
bufdataset1.open;
SpeedButton1Click(Sender);
end;
procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
if ((bufdataset1.State =dsEdit) or (bufdataset1.State =dsInsert)) then
bufdataset1.Cancel ;
if RxDBGrid1.Enabled then begin
DBGrid1.Enabled:=true ;
DBGrid1.DataSource:=datasource1;
RxDBGrid1.DataSource :=nil;
RxDBGrid1.Enabled:=false;
SpeedButton1.Caption :='dbgrid';
end
else begin
RxDBGrid1.Enabled:=true ;
RxDBGrid1.DataSource :=datasource1;
DBGrid1.Enabled:=false;
DBGrid1.DataSource :=nil;
SpeedButton1.Caption :='rxdbgrid';
end;
end;
procedure TForm1.codigoSetText(Sender: TField; const aText: string);
begin
if aText='1' then begin
showmessage('error');
if RxDBGrid1.Enabled then RXDbgrid1.SetFocus
else
DBGrid1.SetFocus;
abort;
end;
sender.Value:=aText;
end;