unit Unit103;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Grids, Wwdbigrd, Wwdbgrid, ExtCtrls, Wwkeycb;

type
  TfmEmpresas = class(TForm)
    Panel1: TPanel;
    wwDBGrid1: TwwDBGrid;
    btnAceptar: TButton;
    btnCancelar: TButton;
    isEmpresa: TwwIncrementalSearch;
    procedure wwDBGrid1KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure btnAceptarClick(Sender: TObject);
    procedure btnCancelarClick(Sender: TObject);
    procedure wwDBGrid1KeyPress(Sender: TObject; var Key: Char);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  fmEmpresas: TfmEmpresas;

implementation

uses Unit101;

{$R *.dfm}

procedure TfmEmpresas.wwDBGrid1KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if key = vk_return then
  begin
    fmConfigConexion.NombreEmpresa := fmConfigConexion.ibquery1.fieldbyname('NOMBRE_CORTO').ASSTRING;
     close;
  end;
end;

procedure TfmEmpresas.btnAceptarClick(Sender: TObject);
begin
  fmConfigConexion.NombreEmpresa := fmConfigConexion.ibquery1.fieldbyname('NOMBRE_CORTO').ASSTRING;
  Close;
end;

procedure TfmEmpresas.btnCancelarClick(Sender: TObject);
begin
  fmConfigConexion.NombreEmpresa := '_NINGUNA_';
  Close;
end;

procedure TfmEmpresas.wwDBGrid1KeyPress(Sender: TObject; var Key: Char);
begin
  isEmpresa.Text := Key;
  isEmpresa.FindValue;
end;

end.
