Re: Can't use TComponent in thread object?



brett wrote:
I've added a Thread Object named TProgressThread to my Delphi7 Win32
project. I created this method in the unit:

procedure TProgressThread.GetRemoteFile;
begin
FtpClient1 := TFtpClient.Create(Self);
...
end;

I get this error when compiling:

[Error] ProgressThread.pas(72): Incompatible types: 'TComponent' and
'TProgressThread'

Line 72 is the FtpClient1 line above. I'm trying to put the
downloading of a file on its own thread. Why can't I use the
FtpClient1 object in the thread class?

Thanks,
Brett

use Nil not Self.
your Thread class isn't a compatible class for an owner because it
does not have a Tcomponent in it most likely. it's only an owner any ways, you just need to clean it up your self before you destroy the
thread.
also, since you obviously are doing this in a thread, i guess you will
need to use blocking sockets.



--
"I'm never wrong, once i thought i was, but was mistaken"
Real Programmers Do things like this.
http://webpages.charter.net/jamie_5

.