Jump to content


azrael11

Member Since 17 May 2011
Offline Last Active Sep 21 2013 11:09 PM
-----

Topics I've Started

Strange problem with TnxProgressColumn

21 September 2013 - 01:28 PM

Hi

I have a strange problem when i use for up to two times the progress in TnxProgress column

First the progress comlum inside the grid
SuperGrid.Columns.Add(TNxProgressColumn,'Progress');
SuperGrid.Columns[5].Width := 100;

second i add this rows and add data to progress column...
the progress column is the column[5]
SuperGrid.Cell[3,i].AsInteger:= 39;
SuperGrid.Cell[3,i].Hint:= 'Program is not downloading';
SuperGrid.Cell[5,i].AsInteger:= 100;

Then i use Indy tidftp to download files from server...
and add this lines in the before, inwork and endwork...

{ TFTPWork }
procedure TFTPWork.BeforeWork(Sender: TObject; AWorkMode: TWorkMode;
  const AWorkCountMax: Integer);
begin
  if AWorkMode= wmWrite then
    TNxProgressColumn(SuperGrid.Columns[5]).Max:= AWorkCountMax
  else
    TNxProgressColumn(SuperGrid.Columns[5]).Max:= MyFileSize;
  SuperGrid.Cell[5,curActing].AsInteger:= 0;
end;
procedure TFTPWork.InWork(Sender: TObject; AWorkMode: TWorkMode;
  const AWorkCount: Integer);
begin
  if TNxProgressColumn(SuperGrid.Columns[5]).Max> 0 then
    SuperGrid.Cell[5,curActing].AsInteger:= AWorkCount;
  Conf.Update;
end;
procedure TFTPWork.WorkEnd(Sender: TObject; AWorkMode: TWorkMode);
begin
  SuperGrid.Cell[6,curActing].AsString:= 'Download Complete';
  Application.ProcessMessages;
  Sleep(2000);
end;

and use this code to download the files i want...
SuperGrid.Cell[6,curActing].AsString:= 'Retriving version';
	    Application.ProcessMessages;
	    sleep(1000);
	    SysUtils.CreateDir(Program_Path + eDatabasePaths[curActing] + 'temp');
	    MyFileSize:= MyFTP.Size(ddatabase + '.ini');
	    MyFTP.Get(ddatabase + '.ini',Program_Path + eDatabasePaths[CurActing] + 'temp\' + ddatabase + '.ini',false);
	    IniVer:= TIniFile.Create(Program_Path + eDatabasePaths[curActing] + 'temp\' + ddatabase + '.ini');
	    dver:= IniVer.ReadString('status','ver',dver);
	    SuperGrid.Cell[3,curActing].AsString:= dver;
	    if FileExists(Program_Path + eDatabasePaths[curActing] + ddatabase + '.ini') then
		  SysUtils.DeleteFile(Program_Path + eDatabasePaths[curActing] + ddatabase + '.ini');
	    MoveFile(PChar(Program_Path + eDatabasePaths[curActing] + 'temp\' + ddatabase + '.ini'),PChar(Program_Path + eDatabasePaths[curActing] + ddatabase + '.ini'));
	    RemoveDir(Program_Path + eDatabasePaths[curActing] + 'temp');
	    SuperGrid.Cell[6,curActing].AsString:= 'Getting database';
	    Application.ProcessMessages;
	    sleep(1000);
	    MyFileSize:= MyFTP.Size(ddatabase + '.zip');
	    MyFTP.Get(ddatabase + '.zip',Program_Path + eDatabasePaths[curActing] + ddatabase + '.zip',false);
	    ftp_disconnect;

here the strange problem ...
when i download the first file everything works perfect...
but when i start to download the second file all the progress of all rows get position to 0...
Any ideas?

Please Help...