unit ufraccionador;

{$AppType CONSOLE}
interface

uses
  Classes, SysUtils,
  Forms,
  Controls,
  Dialogs, StdCtrls,
  ufraccionadorcegh;

type

  { TForm1 }

  TForm1 = class(TForm)
    btCargarCEGH: TButton;
    Button1: TButton;
    Label1: TLabel;
    Nuevo_Fraccionador: TButton;
    Edit1: TEdit;
    Edit2: TEdit;
    Edit3: TEdit;
    Edit4: TEdit;
    Edit5: TEdit;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    od: TOpenDialog;
    procedure btCargarCEGHClick(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Nuevo_FraccionadorClick(Sender: TObject);
  private
    { private declarations }
  public
    { public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.lfm}

{ TForm1 }

procedure TForm1.btCargarCEGHClick(Sender: TObject);
var
  aa,bb,cc:integer;
begin
  if od.Execute then
   begin
     label1.caption:=od.FileName;
     muestra( label1.caption,aa,bb,cc);
     edit2.Text:=inttostr(aa);
     edit3.Text:=inttostr(bb);
     edit4.Text:=inttostr(cc);
     edit5.Text:=label1.caption+'Discr'+ Edit1.Text+'Modifique el nombre.txt';
   end;
end;

procedure TForm1.Button1Click(Sender: TObject);
var
  arch_dest: string;
begin

     if label1.GetTextLen<>0 then
     begin
       arch_dest:= label1.caption+'_111.txt';
       Viejo_Fraccionar( StrToInt(Edit1.Text), label1.caption, arch_dest );
       showmessage( 'Se creó el archivo: '+arch_dest );
     end;
end;

procedure TForm1.Nuevo_FraccionadorClick(Sender: TObject);
var
  arch_dest: string;
begin
     if label1.GetTextLen<>0 then
     begin
       arch_dest:= label1.caption+'_111.txt';
       Fraccionar( StrToInt(Edit1.Text), label1.caption, arch_dest );
       showmessage( 'Se creó el archivo: '+arch_dest );
     end;
     //  fraccionar( 7, 'c:\basura\SintetizadorCEGH_BPS_iN34_cmoBR.txt' );

     //  fraccionar( 7, 'c:\basura\fuentesHidroUY_1VE_BPSov3.txt' );
end;

end.

