unit ualtaediciontpostoper_covarianzaentrecronvars;

{$mode delphi}

interface
uses
{$IFDEF WINDOWS}
  Windows,
{$ENDIF}
  Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, xMatDefs, uHistoVarsOps,
  uBaseAltaEdicionPostOpers, uLectorSimRes3Defs, uVerDoc,
  uPostOpers, ExtCtrls;
type

  { TAltaEdicionTPostOper_covarianzaentrecronvars }

  TAltaEdicionTPostOper_covarianzaentrecronvars = class(TBaseAltaEdicionPostOpers)
    BAyuda: TButton;
    bGuardar: TButton;
    Cancelar: TButton;
    cbRes: TComboBox;
    cbParam1: TComboBox;
    cbParam2: TComboBox;
    divN: TRadioButton;
    divNmenos1: TRadioButton;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Panel1: TPanel;
    rbg_normalizar: TRadioGroup;
    rbg_corrBessel: TRadioGroup;
    procedure BAyudaClick(Sender: TObject);
    procedure CancelarClick(Sender: TObject);
    procedure cbParam1Change(Sender: TObject);
    procedure cbParam2Change(Sender: TObject);
    procedure cbResChange(Sender: TObject);
    procedure bGuardarClick(Sender: TObject); override;
    procedure rbg_corrBesselClick(Sender: TObject);
    function validarFormulario: boolean; override;
  public
    constructor Create(AOwner: TComponent; lector: TLectorSimRes3Defs;
      postOper: TPostOper; tipoPostOper: TClaseDePostOper); override;

  public

  end;

var
  AltaEdicionTPostOper_covarianzaentrecronvars: TAltaEdicionTPostOper_covarianzaentrecronvars;

implementation

{$R *.lfm}

{ TAltaEdicionTPostOper_covarianzaentrecronvars }

procedure TAltaEdicionTPostOper_covarianzaentrecronvars.cbParam1Change(
  Sender: TObject);
begin
  inherited cbCronVarComplementarioChange3(Sender, cbRes, cbParam2, true);
end;

procedure TAltaEdicionTPostOper_covarianzaentrecronvars.CancelarClick(
  Sender: TObject);
begin
  inherited bCancelarClick(Sender);
end;

procedure TAltaEdicionTPostOper_covarianzaentrecronvars.BAyudaClick(
  Sender: TObject);
begin
  verdoc( 3829, tipoPostOper);
end;

procedure TAltaEdicionTPostOper_covarianzaentrecronvars.cbParam2Change(
  Sender: TObject);
begin
 inherited cbCronVarComplementarioChange3(Sender, cbRes, cbParam1, true);
end;

procedure TAltaEdicionTPostOper_covarianzaentrecronvars.cbResChange(
  Sender: TObject);
begin
  inherited cbCronVarComplementarioChange3(Sender, cbParam1, cbParam2, true);
end;

Constructor TAltaEdicionTPostOper_CovarianzaEntreCronVars.Create(AOwner: TComponent;
  lector: TLectorSimRes3Defs; postOper: TPostOper; tipoPostOper: TClaseDePostOper);
var
  cv1, cv2, cv3: TCronVar;
  corrBessel_N: Boolean;
begin
  inherited Create(AOwner, lector, postOper, tipoPostOper);

  inicializarCBCronVars(cbRes, False);
  inicializarCBCronVars(cbParam1, False);
  inicializarCBCronVars(cbParam2, False);

  if postOper <> nil then
  begin
    setCBCronVar(cbRes, TPostOper_CovarianzaEntreCronVars(postOper).res);
    setCBCronVar(cbParam1, TPostOper_CovarianzaEntreCronVars(postOper).param1);
    setCBCronVar(cbParam2, TPostOper_CovarianzaEntreCronVars(postOper).param2);
    rbg_corrBessel.ItemIndex:= TPostOper_CovarianzaEntreCronVars(postOper).corrBessel;
    rbg_normalizar.ItemIndex:= TPostOper_CovarianzaEntreCronVars(postOper).Normalizar;
  end;
end;

procedure TAltaEdicionTPostOper_CovarianzaEntreCronVars.bGuardarClick(
  Sender: TObject);
begin
  if validarFormulario then
  begin
    if postOper = nil then
    begin
      postOper := TPostOper_CovarianzaEntreCronVars.Create(valorCBCronVar(cbRes),
        valorCBCronVar(cbParam1),
        valorCBCronVar(cbParam2),
        rbg_corrBessel.ItemIndex,
        rbg_normalizar.ItemIndex);
    end
    else
    begin
      TPostOper_CovarianzaEntreCronVars(postOper).res := valorCBCronVar(cbRes);
      TPostOper_CovarianzaEntreCronVars(postOper).param1 := valorCBCronVar(cbParam1);
      TPostOper_CovarianzaEntreCronVars(postOper).param2 := valorCBCronVar(cbParam2);
      TPostOper_CovarianzaEntreCronVars(postOper).corrBessel := rbg_corrBessel.ItemIndex;
      TPostOper_CovarianzaEntreCronVars(postOper).Normalizar := rbg_normalizar.ItemIndex;
    end;
    ModalResult := mrOk;
  end;
end;

procedure TAltaEdicionTPostOper_covarianzaentrecronvars.rbg_corrBesselClick(
  Sender: TObject);
begin

end;

function TAltaEdicionTPostOper_Covarianzaentrecronvars.validarFormulario: boolean;
begin
  Result := validarCBCronVars(cbRes) and validarCBCronVars(cbParam1) and
    validarCBCronVars(cbParam1);
end;


end.

