unit fdlgpagosempleados;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ComCtrls;

type
  Tdlgpagosempleados = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    vfecha: TDateTimePicker;
    ibanco: TEdit;
    econcepto: TEdit;
    btnAceptar: TButton;
    iefectivo: TEdit;
    btnCancelar: TButton;
    procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
    procedure FormKeyPress(Sender: TObject; var Key: Char);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  dlgpagosempleados: Tdlgpagosempleados;

implementation

{$R *.dfm}

procedure Tdlgpagosempleados.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  // --- Lógica para la tecla Enter ---
  if Key = VK_RETURN then
  begin
    // Si el control con el foco NO es un botón, nos comportamos como la tecla TAB
    if not (ActiveControl is TButton) then
    begin
      // Marcamos la tecla como manejada para evitar el sonido y el procesamiento por defecto
      Key := 0;
      // Movemos el foco al siguiente control en el orden de tabulación
      SelectNext(ActiveControl, True, True);
    end;
    // Si el control activo SÍ es un botón, no hacemos nada.
    // El sistema ejecutará el evento OnClick del botón, que es lo que queremos.
  end;

  // --- Lógica para la tecla Escape ---
  if Key = VK_ESCAPE then
  begin
    // Marcamos la tecla como manejada y cerramos el formulario cancelando.
    Key := 0;
    btnCancelar.Click;
  end;
end;

procedure Tdlgpagosempleados.FormKeyPress(Sender: TObject; var Key: Char);
begin
    if (key='.') and (activecontrol is tedit) then
    begin
       key:=','
    end;
end;

end.
