Einzelnen Beitrag anzeigen

FaNIX

Registriert seit: 8. Okt 2007
36 Beiträge
 
#5

Re: Basic TThread doesn't work

  Alt 1. Feb 2008, 08:26
Zitat von Luckie:
When you call Synchronize the related code runs in the main forms context. In your case DoIt doesn't run in the context of the thread but in the context of your main form. You shoukd only call Synchronize if you want to access your main form for updating displayed data.
Ahh ok, I see what you meen. But how would I update a label on the main form when calling a method inside the thread with Syncronize? Do i need to include the Mainform unit in my TThread and then access the components from there? Something like form1.label.caption := 'Test'. I'm not sure if that is a nice way of doing it, unless there is another way?

Thanks...
  Mit Zitat antworten Zitat