unit gruposfamilias.Unit2;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs,Vcl.StdCtrls, Vcl.DBCtrls, Vcl.Mask,
  Vcl.ComCtrls, Vcl.Grids, Vcl.DBGrids, Vcl.ExtCtrls, Vcl.DBLookup,datos,
  ZAbstractDataset, ZDataset, Data.DB, ZAbstractRODataset, ZAbstractTable;

type
  Tfgruposfamilias = class(TForm)
    procedure FormKeyPress(Sender: TObject; var Key: Char);
    procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  fgruposfamilias: Tfgruposfamilias;

implementation

{$R *.dfm}

procedure Tfgruposfamilias.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
    if (activecontrol is tdbgrid) then
    begin
        if Key = 13 then Key :=9;

    end;
end;

procedure Tfgruposfamilias.FormKeyPress(Sender: TObject; var Key: Char);
begin
   key:=upcase(key);
    if (key='.') and (activecontrol is tdbedit) then
    begin
       if  (activecontrol as tdbedit).Field.DataType in [ftfloat,ftCurrency,ftbcd,ftfmtbcd] then key:=','
    end;
    if (key='.') and (activecontrol is tdbgrid) then
    begin
        key:=','
    end;
    if (activecontrol is tdbgrid) then
    begin
        if Key = #13 then Key :=#9;
    end;

    if (key=#13) then
    begin
        Perform(WM_NextDLGCtl,0,0);
        key:=#0;
    end;
end;

end.
