Board index » delphi » canvas/thread-question

canvas/thread-question

Hi all!

I have some problems with my little application and is there anyone
out there who can help me, I'd be grateful!
When I use, say, the "image1.canvas.rectangle"-method in the "main
program" everything works fine and a cute rectangle appears. BUT when
I use the same code in a thread it doesn't. I get no error messages,
the thread just stops and eventually the whole program starts messing
and hangs.
Why?

Thanx in advance
PS

 

Re:canvas/thread-question


d: babb...@home.se (P Svantesson) wrote:

Quote
>Hi all!

>I have some problems with my little application and is there anyone
>out there who can help me, I'd be grateful!
>When I use, say, the "image1.canvas.rectangle"-method in the "main
>program" everything works fine and a cute rectangle appears. BUT when
>I use the same code in a thread it doesn't. I get no error messages,
>the thread just stops and eventually the whole program starts messing
>and hangs.
>Why?

You need to .Synchronize your call (TThread.Synchronize).

--
Stefan.Hoffmeister (at) Uni-Passau.de
http://kakadu.rz.uni-passau.de/~w4hoff01/Delphi
   DIR: Delphi FAQs, KBs, docs

Private email regarding Delphi will usually be ignored
unless it has been expressedly invited.

Other Threads