Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > OOP
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

Grupo de Teaming del ClubDelphi

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 05-08-2014
Chaja Chaja is offline
No confirmado
 
Registrado: ago 2004
Ubicación: Mar del Plata
Posts: 238
Poder: 0
Chaja Va por buen camino
Error canvas does not allow drawing

estimados...
hace bastante que no ando por aqui y vengo con una situacion q no se como solucionarla. Para los que nos son de mi pais (Argentina) algunos clientes deben hacer retenciones de Ingresos Brutos (Impuesto provincial ) cuando cobran u/o hacen vtas. Para ello la agencia de recaudacion genera un archivo que se debe bajar desde la pagina, y el cual es de formato txt y contiene aproximadamente 3.500.000 de reg. Para eso hice una pantalla de carga y recorre todo el txt y va ingresando los reg. o actualizando.
A continuacion pongo el codigo que usos en dicha pantalla:

Código Delphi [-]
unit UTasas_Ret_perc;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  UABMBase, Wwintl, wwDialog, wwidlg, Db, DBTables,
  ActnList, ComCtrls, Buttons, StdCtrls, ToolWin,
  ExtCtrls, DBCtrls, Provider, DBClient, Grids, DBGrids,Mask,
  JvComponentBase, ImgList, JvExControls,Math,
  JvGradient, JvFormPlacement, JvLabel, JvDBControls, FMTBcd, SqlExpr,
  JvAnimatedImage, JvThread;

type
  TFormTasasRet_Perc = class(TFormABMBase)
    edPath: TEdit;
    SpeedButton1: TSpeedButton;
    Label2: TLabel;
    OpenDialog: TOpenDialog;
    LeerTxt: TAction;
    CDSTasas: TClientDataSet;
    DSPTasas: TDataSetProvider;
    dbgDetalle: TDBGrid;
    CDSTasasCUIT: TStringField;
    CDSTasasTIPO_CONVENIO: TStringField;
    CDSTasasESTADO: TStringField;
    CDSTasasCAMBIO_ALICUOTA: TStringField;
    CDSTasasGRUPO_PERCEPCION: TSmallintField;
    CDSTasasGRUPO_RETENCION: TSmallintField;
    DSTasas: TDataSource;
    BitBtn1: TBitBtn;
    Label1: TLabel;
    Label3: TLabel;
    lbReg: TLabel;
    lbNroReg: TLabel;
    ComboBox1: TComboBox;
    Label4: TLabel;
    lbTiempoLectua: TLabel;
    Label6: TLabel;
    Label5: TLabel;
    Label7: TLabel;
    lbinicio: TLabel;
    lbfin: TLabel;
    Label8: TLabel;
    Bevel1: TBevel;
    Label9: TLabel;
    QTasas: TSQLQuery;
    QTasasCUIT: TStringField;
    QTasasFECHA: TSQLTimeStampField;
    QTasasDESDE: TSQLTimeStampField;
    QTasasHASTA: TSQLTimeStampField;
    QTasasTIPO_CONVENIO: TStringField;
    QTasasESTADO: TStringField;
    QTasasCAMBIO_ALICUOTA: TStringField;
    QTasasTASA_PERCEPCION: TFMTBCDField;
    QTasasTASA_RETENCION: TFMTBCDField;
    QTasasGRUPO_PERCEPCION: TSmallintField;
    QTasasGRUPO_RETENCION: TSmallintField;
    CDSTasasFECHA: TSQLTimeStampField;
    CDSTasasDESDE: TSQLTimeStampField;
    CDSTasasHASTA: TSQLTimeStampField;
    CDSTasasTASA_PERCEPCION: TFMTBCDField;
    CDSTasasTASA_RETENCION: TFMTBCDField;
    QBorrar: TSQLQuery;
    spGravar: TSQLStoredProc;
    DBStatusLabel2: TJvDBStatusLabel;
    MemoText: TRichEdit;
    chbBorrarDatos: TCheckBox;
    QBuscaCuit: TSQLQuery;
    StringField1: TStringField;
    SQLTimeStampField1: TSQLTimeStampField;
    SQLTimeStampField2: TSQLTimeStampField;
    SQLTimeStampField3: TSQLTimeStampField;
    StringField2: TStringField;
    StringField3: TStringField;
    StringField4: TStringField;
    FMTBCDField1: TFMTBCDField;
    FMTBCDField2: TFMTBCDField;
    SmallintField1: TSmallintField;
    SmallintField2: TSmallintField;
    spGravar_2: TSQLStoredProc;
    BitBtn2: TBitBtn;
    jvHiloTx: TJvThread;
    pgProceso: TProgressBar;
    Timer1: TTimer;
    Label10: TLabel;
    lbPorMinuto: TLabel;
    lbRestan: TLabel;
    lbMinutos: TLabel;
    procedure LeerTxtExecute(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure SpeedButton1Click(Sender: TObject);
    procedure ConfirmaExecute(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormKeyPress(Sender: TObject; var Key: Char);
    procedure FormShow(Sender: TObject);
    procedure CancelarExecute(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure BorrarExecute(Sender: TObject);
    procedure BitBtn2Click(Sender: TObject);
    procedure jvHiloTxExecute(Sender: TObject; Params: Pointer);
    procedure Timer1Timer(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    TotalReg,TotalProcesado,TotalxMinuto,Minutos:Integer;
    Tiempo:TDateTime;
    procedure CargarPadron;
  end;

var
  Cancelado:Boolean;
  ArchiTxt:TextFile;
  I:Integer;
  FormTasasRet_Perc: TFormTasasRet_Perc;

implementation

uses DMMainForm_2;

{$R *.DFM}

procedure TFormTasasRet_Perc.CargarPadron;
VAR Tipo,S:String;
aux:Real;
posicion:Integer;
begin
  inherited;

  if MemoText.Lines.Count<=0 Then
    Raise Exception.Create('No hay datos para procesar...');
 // GifProceso.Visible:=True;
 // GifProceso.Animate:=True;
  if chbBorrarDatos.Checked then
    begin
      Borrar.Execute;
    end;
  btBorrar.Enabled:=False;
  CDSTasas.Close;
  CDSTasas.Open;
  btCancelar.Enabled:=True;
  btSalir.Enabled   :=False;
  if ComboBox1.ItemIndex=0 Then
    DecimalSeparator:=','
  else
  if ComboBox1.ItemIndex=1 Then
    DecimalSeparator:='.';

  Cancelado:=False;
  TotalReg:=0;
  TotalProcesado:=0;
  Minutos:=0;
  lbinicio.Caption:=TimeToStr(Now);
  pgProceso.Min:=0;
  pgProceso.Max:=MemoText.Lines.Count-1;
  pgProceso.Position:=0;
  TotalReg:=MemoText.Lines.Count-1;
  Timer1.Enabled:=True;
  for posicion:=0 to MemoText.Lines.Count-1 do
    begin
      TotalxMinuto     := TotalxMinuto+1; // este se resetea..
      TotalProcesado   := posicion;
      lbNroReg.Caption := IntToStr(posicion);
      lbRestan.Caption := FormatDateTime('hh:mm',Tiempo);
      lbMinutos.Caption:= FormatDateTime('ss',Now);
      s:=MemoText.Lines[posicion];
      pgProceso.Position:=posicion;
  //    Application.ProcessMessages;
      if cancelado=False Then
        begin
          spGravar_2.close;
          Tipo:=copy(s,1,1);
          spGravar_2.ParamByName('TIPO_PERCECPION').Value  := copy(s,1,1);
          delete(s,1,2);
          spGravar_2.ParamByName('desde').AsDate  := StrToDateTime(FormatDateTime('dd/mm/yyyy',StrToDate( (Copy(s,10,2) +'/'+ Copy(s,12,2) +'/'+ Copy(s,14,4) ))));
          spGravar_2.ParamByName('hasta').AsDate  := StrToDateTime(FormatDateTime('dd/mm/yyyy',StrToDate( (Copy(s,19,2) +'/'+ Copy(s,21,2) +'/'+ Copy(s,23,4) ))));
          spGravar_2.ParamByName('fecha').AsDate  := StrToDateTime(FormatDateTime('dd/mm/yyyy',StrToDate( (Copy(s,1,2)  +'/'+ Copy(s,3,2)  +'/'+ Copy(s,5,4) ))));
          spGravar_2.ParamByName('cuit').Value    := Copy(s,28,2)+'-'+Copy(s,30,8)+'-'+copy(s,38,1);
          spGravar_2.ParamByName('tipo').Value    := Copy(s,40,1);  // tipo de contribuyente
          spGravar_2.ParamByName('estado').Value  := Copy(S,42,1);  // se se da de alta o baja
          spGravar_2.ParamByName('cambio').Value  := Copy(s,44,1);  // si cambio la alicuota
          if Tipo='P' then
            spGravar_2.ParamByName('tasa_perc').AsFloat := StrToFloat(copy(s,46,4))
          else
            if Tipo='R' then
               spGravar_2.ParamByName('tasa_ret').AsFloat  :=  StrToFloat(copy(s,46,4));

          spGravar_2.ParamByName('g_per').Value := StrToInt(Copy(s,51,2));
          spGravar_2.ParamByName('g_ret').Value := StrToInt(Copy(s,51,2));
     //    spGravar.ParamByName('g_ret').Value := StrToInt(Copy(s,59,2));
          spGravar_2.ExecProc;
          spGravar_2.close;
        end
      else
        if MessageDlg('continua ?',mtConfirmation, [mbYes, mbNo], 0) = mrYes then
          begin
            btCancelar.Enabled:=True;
            btSalir.Enabled   :=False;
           // GifProceso.Visible:=True;
           // GifProceso.Animate:=True;
            btBorrar.Enabled:=False;
            cancelado:=False;
         //    Application.ProcessMessages;
          end
        else
          begin
            DecimalSeparator  :='.';
           // GifProceso.Visible:=False;
           // GifProceso.Animate:=False;
             pgProceso.Position:=0;
            lbfin.Caption     :=TimeToStr(now);
            btCancelar.Enabled:=False;
            btBorrar.Enabled  :=True;
            btSalir.Enabled   :=True;
            Timer1.Enabled:=False;
        //    Application.ProcessMessages;
            exit;
          end;
       jvHiloTx.Synchronize();
    end;
  DecimalSeparator  :='.';
 // GifProceso.Visible:=False;
 // GifProceso.Animate:=False;
  lbfin.Caption     :=TimeToStr(now);

  btCancelar.Enabled:=False;
  btBorrar.Enabled  :=True;
  btSalir.Enabled   :=True;
  Timer1.Enabled:=False;
end;


procedure TFormTasasRet_Perc.LeerTxtExecute(Sender: TObject);
VAR S:String;
aux:Real;
posicion:Integer;
begin
  inherited;

  if MemoText.Lines.Count<=0 Then
    Raise Exception.Create('No hay datos para procesar...');
  //GifProceso.Visible:=True;
 // GifProceso.Animate:=True;
  if chbBorrarDatos.Checked then
    begin
      Borrar.Execute;
    end;
  btBorrar.Enabled:=False;
  CDSTasas.Close;
  CDSTasas.Open;
  btCancelar.Enabled:=True;
  btSalir.Enabled   :=False;
  if ComboBox1.ItemIndex=0 Then
    DecimalSeparator:=','
  else
  if ComboBox1.ItemIndex=1 Then
    DecimalSeparator:='.';

  Cancelado:=False;

  lbinicio.Caption:=TimeToStr(Now);

  for posicion:=0 to MemoText.Lines.Count-1 do
    begin
     // Application.ProcessMessages;
      lbNroReg.Caption:=IntToStr(posicion);
      s:=MemoText.Lines[posicion];
      if cancelado=False Then
        begin
          spGravar.close;
          spGravar.ParamByName('cuit').Value    := Copy(s,28,2)+'-'+Copy(s,30,8)+'-'+copy(s,38,1);

          spGravar.ParamByName('fecha').AsDate  := StrToDateTime(FormatDateTime('dd/mm/yyyy',StrToDate( (Copy(s,1,2)  +'/'+ Copy(s,3,2)  +'/'+ Copy(s,5,4) ))));
          spGravar.ParamByName('desde').AsDate  := StrToDateTime(FormatDateTime('dd/mm/yyyy',StrToDate( (Copy(s,10,2) +'/'+ Copy(s,12,2) +'/'+ Copy(s,14,4) ))));
          spGravar.ParamByName('hasta').AsDate  := StrToDateTime(FormatDateTime('dd/mm/yyyy',StrToDate( (Copy(s,19,2) +'/'+ Copy(s,21,2) +'/'+ Copy(s,23,4) ))));
          spGravar.ParamByName('tipo').Value    := Copy(s,40,1);
          spGravar.ParamByName('estado').Value  := Copy(S,42,1);
          spGravar.ParamByName('cambio').Value  := Copy(s,44,1);
          spGravar.ParamByName('tasa_perc').AsFloat := StrToFloat(copy(s,46,4));
          spGravar.ParamByName('tasa_ret').AsFloat  := StrToFloat(Copy(s,51,3));

          spGravar.ParamByName('g_per').Value := StrToInt(Copy(s,56,2));
          spGravar.ParamByName('g_ret').Value := StrToInt(Copy(s,59,2));
          spGravar.ExecProc;
          spGravar.close;
        end
      else
        if MessageDlg('continua ?',mtConfirmation, [mbYes, mbNo], 0) = mrYes then
          begin
            btCancelar.Enabled:=True;
            btSalir.Enabled   :=False;
           // GifProceso.Visible:=True;
           // GifProceso.Animate:=True;
            btBorrar.Enabled:=False;
            cancelado:=False;
          end
        else
          begin
            DecimalSeparator  :='.';
           // GifProceso.Visible:=False;
           // GifProceso.Animate:=False;
            lbfin.Caption     :=TimeToStr(now);
            btCancelar.Enabled:=False;
            btBorrar.Enabled  :=True;
            btSalir.Enabled   :=True;
           
            exit;
          end;
    end;
  DecimalSeparator  :='.';
 // GifProceso.Visible:=False;
 // GifProceso.Animate:=False;
  lbfin.Caption     :=TimeToStr(now);

  btCancelar.Enabled:=False;
  btBorrar.Enabled  :=True;
  btSalir.Enabled   :=True;
end;

procedure TFormTasasRet_Perc.FormCreate(Sender: TObject);
begin
  inherited;
  AutoSize:=True;
  //GifProceso.Visible :=False;
 // GifProceso.Animate :=False;
  ComboBox1.ItemIndex:=0;
  MemoText.Clear;
 // AddClientDataSet(CDSTasas,DSPTasas);
  CDSTasas.Open;
end;

procedure TFormTasasRet_Perc.SpeedButton1Click(Sender: TObject);
var Inicio:TDateTime;
begin
  inherited;
  if OpenDialog.Execute Then
    if OpenDialog.FileName<>'' Then
      begin
        Screen.Cursor:=crHourGlass;
        sbEstado.SimpleText:='Cargando Archivo....';
        Application.ProcessMessages;
        Inicio:=Now;
        edPath.Text:=OpenDialog.FileName;
        AssignFile(ArchiTxt, OpenDialog.FileName);
        Reset(ArchiTxt);
        MemoText.Lines.LoadFromFile(OpenDialog.FileName);
        lbReg.Caption:=IntToStr(MemoText.Lines.Count-1);
        lbTiempoLectua.Caption:=TimetoStr(inicio-now);
        Screen.Cursor:=crDefault;
      end
    else
      ShowMessage('No hay archivo Seleccionado');
  sbEstado.SimpleText:='..';
  Application.ProcessMessages;
  Screen.Cursor:=crDefault;

end;

procedure TFormTasasRet_Perc.Timer1Timer(Sender: TObject);
var aux:extended;
begin
  inherited;
  lbPorMinuto.Caption:=IntToStr(TotalxMinuto);
  if (TotalxMinuto>0) then
    Aux:=((((TotalReg-TotalProcesado)*60000)/TotalxMinuto)/60000)/60
  else
    Aux:=0;  
  TotalxMinuto:=0;
  Aux   := RoundTo(Aux,-2);
  Tiempo:= Aux;

 // Application.ProcessMessages;
end;

procedure TFormTasasRet_Perc.ConfirmaExecute(Sender: TObject);
begin
//  inherited;
//  CDSTasas.ApplyUpdates(-1);
end;

procedure TFormTasasRet_Perc.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  inherited;
  MemoText.Clear;
  CDSTasas.Close;
  DecimalSeparator:='.';
  Action:=caFree;
end;

procedure TFormTasasRet_Perc.FormKeyPress(Sender: TObject; var Key: Char);
begin
  inherited;
  if Key=#27 Then
    Cancelado:=True
  else
    Cancelado:=False;
end;

procedure TFormTasasRet_Perc.FormShow(Sender: TObject);
begin
  inherited;
//  btCancelar.Enabled:=False;
//  btSalir.Enabled   :=True;
end;

procedure TFormTasasRet_Perc.jvHiloTxExecute(Sender: TObject; Params: Pointer);
begin
  inherited;
  CargarPadron;
  jvHiloTx.Terminate;
end;

procedure TFormTasasRet_Perc.CancelarExecute(Sender: TObject);
begin
 // inherited;
   Cancelado:=True;
   btCancelar.Enabled:=False;
   btConfirma.Enabled:=False;
   btSalir.Enabled   :=True;
  // GifProceso.Visible:=False;
  // GifProceso.Animate:=False;

//   MemoText.Clear;
//   CDSTasas.Close;
//   CDSTasas.Params.Clear;
//   CDSTasas.Open;
end;

procedure TFormTasasRet_Perc.FormDestroy(Sender: TObject);
begin
  inherited;
  FormTasasRet_Perc:=nil;
end;

procedure TFormTasasRet_Perc.BitBtn2Click(Sender: TObject);
begin
  inherited;
  jvHiloTx.FreeOnTerminate:=True;
  jvHiloTx.Execute(self);
end;

procedure TFormTasasRet_Perc.BorrarExecute(Sender: TObject);
begin
 // inherited;
  QBorrar.Close;
  QBorrar.ExecSQL;
  QBorrar.Close;
  CDSTasas.Close;
  CDSTasas.Open;
end;

end.
esto parece que anda bien pero al llegar al reg 26.000 o 28.000
ma salta el error

canvas does not allow drawing

y se cuelga. Segun dice por ahi es debido a la falta de recursos, he observado que cuando se ejcuta el hilo, en el administrador de tarea el sistema empieza a utilizar memo, pero nunca se libera, es asi?
Si alguien me puede decir como corregir esto se los agradeceria...

Luis Roldan
Mar del Plata
Argentina
Responder Con Cita
  #2  
Antiguo 05-08-2014
Avatar de Casimiro Notevi
Casimiro Notevi Casimiro Notevi is offline
Moderador
 
Registrado: sep 2004
Ubicación: En algún lugar.
Posts: 32.020
Poder: 10
Casimiro Notevi Tiene un aura espectacularCasimiro Notevi Tiene un aura espectacular
Mira los enlaces de abajo, al final de la página, a ver si te sirven.
Responder Con Cita
  #3  
Antiguo 05-08-2014
Avatar de Neftali [Germán.Estévez]
Neftali [Germán.Estévez] Neftali [Germán.Estévez] is offline
[becario]
 
Registrado: jul 2004
Ubicación: Barcelona - España
Posts: 18.233
Poder: 10
Neftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en bruto
A priori yo no veo nada que pueda consumir recursos hasta que la máquina quede sin memoria, aunque habría que verlo ejecutando.
¿Exactamente cual es el procedimiento que está ejecutándose cuando falla (hay 2 que hacen un recorrido)?

Por ahí también aparecen referencias a un Thread que no si si está dentro del proceso. ?¿?¿

Por un lado, sin saber nada más y para ir descartando cosas, yo eliminaría la carga en un memo de todo el contenido del fichero y haría la carga/lectura directamente desde disco.
Otra opción es ir comentando partes del código para ver cual de ellas es la que está "comiendo" memoria hasta acabarla.
__________________
Germán Estévez => Web/Blog
Guía de estilo, Guía alternativa
Utiliza TAG's en tus mensajes.
Contactar con el Clubdelphi

P.D: Más tiempo dedicado a la pregunta=Mejores respuestas.
Responder Con Cita
  #4  
Antiguo 05-08-2014
Chaja Chaja is offline
No confirmado
 
Registrado: ago 2004
Ubicación: Mar del Plata
Posts: 238
Poder: 0
Chaja Va por buen camino
Estimado Neftali.

El Procedimiento Principal es

Código Delphi [-]

procedure TFormTasasRet_Perc.CargarPadron;
VAR Tipo,S:String;
aux:Real;
posicion:Integer;
begin
  inherited;

  if MemoText.Lines.Count<=0 Then
    Raise Exception.Create('No hay datos para procesar...');
 // GifProceso.Visible:=True;
 // GifProceso.Animate:=True;
  if chbBorrarDatos.Checked then
    begin
      Borrar.Execute;
    end;
  btBorrar.Enabled:=False;
  CDSTasas.Close;
  CDSTasas.Open;
  btCancelar.Enabled:=True;
  btSalir.Enabled   :=False;
  if ComboBox1.ItemIndex=0 Then
    DecimalSeparator:=','
  else
  if ComboBox1.ItemIndex=1 Then
    DecimalSeparator:='.';

  Cancelado:=False;
  TotalReg:=0;
  TotalProcesado:=0;
  Minutos:=0;
  lbinicio.Caption:=TimeToStr(Now);
  pgProceso.Min:=0;
  pgProceso.Max:=MemoText.Lines.Count-1;
  pgProceso.Position:=0;
  TotalReg:=MemoText.Lines.Count-1;
  Timer1.Enabled:=True;
  for posicion:=0 to MemoText.Lines.Count-1 do
    begin
      TotalxMinuto     := TotalxMinuto+1; // este se resetea..
      TotalProcesado   := posicion;
      lbNroReg.Caption := IntToStr(posicion);
      lbRestan.Caption := FormatDateTime('hh:mm',Tiempo);
      lbMinutos.Caption:= FormatDateTime('ss',Now);
      s:=MemoText.Lines[posicion];
      pgProceso.Position:=posicion;
  //    Application.ProcessMessages;
      if cancelado=False Then
        begin
          spGravar_2.close;
          Tipo:=copy(s,1,1);
          spGravar_2.ParamByName('TIPO_PERCECPION').Value  := copy(s,1,1);
          delete(s,1,2);
          spGravar_2.ParamByName('desde').AsDate  := StrToDateTime(FormatDateTime('dd/mm/yyyy',StrToDate( (Copy(s,10,2) +'/'+ Copy(s,12,2) +'/'+ Copy(s,14,4) ))));
          spGravar_2.ParamByName('hasta').AsDate  := StrToDateTime(FormatDateTime('dd/mm/yyyy',StrToDate( (Copy(s,19,2) +'/'+ Copy(s,21,2) +'/'+ Copy(s,23,4) ))));
          spGravar_2.ParamByName('fecha').AsDate  := StrToDateTime(FormatDateTime('dd/mm/yyyy',StrToDate( (Copy(s,1,2)  +'/'+ Copy(s,3,2)  +'/'+ Copy(s,5,4) ))));
          spGravar_2.ParamByName('cuit').Value    := Copy(s,28,2)+'-'+Copy(s,30,8)+'-'+copy(s,38,1);
          spGravar_2.ParamByName('tipo').Value    := Copy(s,40,1);  // tipo de contribuyente
          spGravar_2.ParamByName('estado').Value  := Copy(S,42,1);  // se se da de alta o baja
          spGravar_2.ParamByName('cambio').Value  := Copy(s,44,1);  // si cambio la alicuota
          if Tipo='P' then
            spGravar_2.ParamByName('tasa_perc').AsFloat := StrToFloat(copy(s,46,4))
          else
            if Tipo='R' then
               spGravar_2.ParamByName('tasa_ret').AsFloat  :=  StrToFloat(copy(s,46,4));

          spGravar_2.ParamByName('g_per').Value := StrToInt(Copy(s,51,2));
          spGravar_2.ParamByName('g_ret').Value := StrToInt(Copy(s,51,2));
     //    spGravar.ParamByName('g_ret').Value := StrToInt(Copy(s,59,2));
          spGravar_2.ExecProc;
          spGravar_2.close;
        end
      else
        if MessageDlg('continua ?',mtConfirmation, [mbYes, mbNo], 0) = mrYes then
          begin
            btCancelar.Enabled:=True;
            btSalir.Enabled   :=False;
           // GifProceso.Visible:=True;
           // GifProceso.Animate:=True;
            btBorrar.Enabled:=False;
            cancelado:=False;
         //    Application.ProcessMessages;
          end
        else
          begin
            DecimalSeparator  :='.';
           // GifProceso.Visible:=False;
           // GifProceso.Animate:=False;
             pgProceso.Position:=0;
            lbfin.Caption     :=TimeToStr(now);
            btCancelar.Enabled:=False;
            btBorrar.Enabled  :=True;
            btSalir.Enabled   :=True;
            Timer1.Enabled:=False;
        //    Application.ProcessMessages;
            exit;
          end;
      
    end;
  DecimalSeparator  :='.';
 // GifProceso.Visible:=False;
 // GifProceso.Animate:=False;
  lbfin.Caption     :=TimeToStr(now);

  btCancelar.Enabled:=False;
  btBorrar.Enabled  :=True;
  btSalir.Enabled   :=True;
  Timer1.Enabled:=False;
end;

previeamente hago leer el tx para cargarlo al memo.

que hace a la cargar del padron, lo puse dentro de un trhead por que si no se me congelaba la maquina.
Lo q nunca hice es leer desde el disco el txt....????? se puede hacer eso?
Responder Con Cita
  #5  
Antiguo 05-08-2014
Avatar de Neftali [Germán.Estévez]
Neftali [Germán.Estévez] Neftali [Germán.Estévez] is offline
[becario]
 
Registrado: jul 2004
Ubicación: Barcelona - España
Posts: 18.233
Poder: 10
Neftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en bruto
Cita:
Empezado por Chaja Ver Mensaje
Lo q nunca hice es leer desde el disco el txt....????? se puede hacer eso?
Revisa en la ayuda las funciones AssignFile, Reset, ReadLn,...
Si buscas en los foros y en la sección de trucos encontrarás muchos códigos de cómo utilizarlas para leer un fichero.
En la ayuda de Delphi seguro que también viene algún código de ejemplo.
__________________
Germán Estévez => Web/Blog
Guía de estilo, Guía alternativa
Utiliza TAG's en tus mensajes.
Contactar con el Clubdelphi

P.D: Más tiempo dedicado a la pregunta=Mejores respuestas.
Responder Con Cita
Respuesta


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Copiar TLabel.Canvas sobre TBitmap.Canvas @CSE1970 Gráficos 2 23-10-2013 13:46:53
Runtime error relacionado con Canvas modulay OOP 2 03-10-2007 03:19:05
Canvas Does Not Allow Drawing ebeltete Gráficos 21 15-01-2007 17:07:25
Rave: Canvas does not allow drawing Brewster Impresión 0 14-07-2004 20:26:32
Canvas does not allow drawing MADV01 Impresión 1 02-04-2004 16:08:43


La franja horaria es GMT +2. Ahora son las 10:49:33.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi