Ver Mensaje Individual
  #3  
Antiguo 11-05-2006
freelance freelance is offline
Registrado
 
Registrado: may 2006
Posts: 9
Reputación: 0
freelance Va por buen camino
Se me olvidaba ...

para usar Enter en vez de Tab en los TEdit:

procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);
begin
if TForm(Sender).ActiveControl is TEdit then
if key = #13 then begin
key := #0; // como si no pulsasemos nada
Perform(WM_NEXTDLGCTL, 0, 0); // saltamos al siguiente control
end;
end;

Por cierto: Es necesario poner a True la propiedad KeyPreview del Form.


para usar Enter en vez de Tab para cambiar de columna en los TStringGrid

procedure TForm1.StringGrid1KeyPress(Sender: TObject; var Key: Char);
begin
if key = #13 then
begin
key := #0;
with TStringGrid(Sender) do
if col+1 < colCount then
col := col+1;
end;
inherited;
end;

en un TDBGrid:

procedure TForm1.DBGrid1KeyPress(Sender: TObject; var Key: Char);
begin
if key = #13 then
begin
key := #0;
with TDBGrid(Sender) do
if SelectedIndex+1 < FieldCount then
SelectedIndex := SelectedIndex+1;
end;
inherited;
end;


espero haberte ayudado ...

Última edición por freelance fecha: 11-05-2006 a las 23:14:33.
Responder Con Cita