opc0de
opc0de

Reputation: 11767

How to implement a progress bar with TIdTCPClient?

I am using indy 10 and i was wondering how can i implement a progress bar for transfering a file.I tried with onWork events but they are not triggred. Another thing that i find anoying is that the application freezes until the stream is downloaded.

What am i doing wrong ?

Upvotes: 1

Views: 1657

Answers (2)

Seth Carnegie
Seth Carnegie

Reputation: 75130

You can put the download code into another thread using TThread so that your app doesn't freeze while downloading, and have a procedure that you send to TThread.Synchronize to update the progress bar. Also, for OnWork to be called, you have to call OnWorkBegin first, see http://www.borlandtalk.com/image-vp569607.html

Upvotes: 0

Stijn Sanders
Stijn Sanders

Reputation: 36840

Add an IdAntiFreeze component to your form and use it's properties and events to get notified of the progress of the network operations.

Upvotes: 2

Related Questions