Jump to content


Photo

Strange problem with TnxProgressColumn


  • Please log in to reply
4 replies to this topic

#1 azrael11

azrael11
  • Members
  • 33 posts

Posted 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...

#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,289 posts
  • Gender:Male

Posted 21 September 2013 - 02:16 PM

Hello ,

Unfortunately I am not familiar with TIdFTP component, maybe you can inspect which value is stored inside Max property (file size). Maybe it is set to value < 0 and this is why it won't go up.
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#3 azrael11

azrael11
  • Members
  • 33 posts

Posted 21 September 2013 - 02:25 PM

Hello ,

Unfortunately I am not familiar with TIdFTP component, maybe you can inspect which value is stored inside Max property (file size). Maybe it is set to value < 0 and this is why it won't go up.


Hello Boki

I check and double check again everything seems to be in place
The curActing gets the rownumber... check
The max property gets first and then the second right... check
The progress property of the progresscolumn row set to 0 before it starts... check.

Everything seem to be ok ... except somehow when it starts to download the second file ....
All the progress in all rows get 0 in their position...

Thank you Boki...

#4 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,289 posts
  • Gender:Male

Posted 21 September 2013 - 03:04 PM

Hello,

Maybe you can step into TProgressColumnDisplay.DrawProgressBar method inside NxDisplays and see what is wrong.

It is quite easy to understand: a ratio is calculated (Pos/Max *100) and size of BoxRect is calculated. Maybe you can place mouse over some of variables there and see what is wrong.
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#5 azrael11

azrael11
  • Members
  • 33 posts

Posted 21 September 2013 - 06:03 PM

Hello,

Maybe you can step into TProgressColumnDisplay.DrawProgressBar method inside NxDisplays and see what is wrong.

It is quite easy to understand: a ratio is calculated (Pos/Max *100) and size of BoxRect is calculated. Maybe you can place mouse over some of variables there and see what is wrong.


I'll check that...

Thank you again...




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users