unit Passign;

interface

uses WinTypes, WinProcs, Classes, Graphics, Forms, Controls, Buttons,
  StdCtrls, ExtCtrls, SetPlace,SysUtils, inputdat;



type
  TFAssign = class(TForm)
    OKBtn: TBitBtn;
    CancelBtn: TBitBtn;
    Bevel1: TBevel;
    Site: TComboBox;
    Label1: TLabel;
    Edit1: TEdit;
    Label3: TLabel;
    Button1: TButton;
    procedure FormActivate(Sender: TObject);
    procedure SiteChange(Sender: TObject);
    procedure Edit1Change(Sender: TObject);
    procedure OKBtnClick(Sender: TObject);
    procedure CancelBtnClick(Sender: TObject);
    procedure HelpBtnClick(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FAssign: TFAssign;

implementation

{$R *.DFM}



procedure TFAssign.FormActivate(Sender: TObject);
var
 i:integer;
begin
Site.text:='';
Site.items.clear;
 for i:=1 to MaxSelSite do
   Site.items.add(SelSite[i].code);
Site.itemindex:=indexsite;
Site.text:= SelSite[indexsite+1].code;
 SiteChange(Sender);
 Site.SetFocus;
end;


procedure TFAssign.SiteChange(Sender: TObject);
var
cad:string;
begin
 Str(EfecHuman[Site.ItemIndex+1].intensidad:4:1,cad);
 Edit1.Text:=cad;
 indexsite:=Site.ItemIndex;
end;

procedure TFAssign.Edit1Change(Sender: TObject);
var
 cod:integer;
 cad:string;
begin
if length(Edit1.Text)>0 then
if (Edit1.Text[length(Edit1.Text)] in ['0'..'9']) or
   (Edit1.Text[length(Edit1.Text)]='.') then
   begin
    cad:=Edit1.Text;
    val(cad,EfecHuman[Site.ItemIndex+1].intensidad,cod);
   end
end;

procedure TFAssign.OKBtnClick(Sender: TObject);
var
i:integer;
begin
 for i:=1 to MaxSelSite do
   SelSite[i].intensidad:=EfecHuman[i].intensidad;
Close;
end;

procedure TFAssign.CancelBtnClick(Sender: TObject);
var
i:integer;
begin
 for i:=1 to MaxSelSite do
   EfecHuman[i].intensidad := SelSite[i].intensidad;
Close;
end;

procedure TFAssign.HelpBtnClick(Sender: TObject);
begin
Application.HelpJump('Assign_Intensity');
end;

procedure TFAssign.Button1Click(Sender: TObject);
begin
if  Site.ItemIndex<MaxSelSite-1 then
Site.ItemIndex:=Site.ItemIndex + 1 else
Site.ItemIndex:=0;
SiteChange(Sender);
end;

end.
