Ver Mensaje Individual
  #2  
Antiguo 29-01-2014
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Reputación: 36
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
Hola Josep.

Fijate si te sirve de este modo:
Código Delphi [-]
...
var
  NoPost: Boolean = False;

procedure TForm1.DataSetBeforePost(DataSet: TDataSet);
begin
  if NoPost then Abort;
end;

type
  DBGridExt = class(TDBGrid);

procedure TForm1.DBGrid1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
  with DBGridExt(TDBGrid(Sender)) do
  begin
    case Key of
      VK_TAB :NoPost := SelectedIndex = Columns.Count-1; // (si no deseas que guarde con TAB)
      VK_DOWN:begin
                NoPost := True;
                if (Key = VK_DOWN)and(Row = RowCount-1) then Abort;
              end;
      VK_UP  :NoPost := True;
    end;
  end;
end;
Eso si, tendras que recordar poner el valor de NoPost en False antes de llamar al método Post, por ejemplo:
Código Delphi [-]
procedure TForm1.btnGuardar(Sender: TObject);
begin
  NoPost:= False;
  DataSet.Post;
end;

Saludos
__________________
Daniel Didriksen

Guía de estilo - Uso de las etiquetas - La otra guía de estilo ....
Responder Con Cita