[Lazarus] TThread.Synchronize

LacaK lacak at zoznam.sk
Wed Oct 26 12:02:13 CEST 2016

Dňa 26.10.2016 o 11:17 Michael Schnell via Lazarus napísal(a):
> On 26.10.2016 07:57, LacaK via Lazarus wrote:
>> procedure TRefreshFileListThread.Execute;
>> begin
>>   while not Terminated do begin
>>     Synchronize(@MyForm.UpdateFileList); // UpdateFileList is method 
>> which clears listbox and then adds files in given shared folder
>>     Sleep(10000);
>>   end;
> This only makes sense if the actual file list generation (all but the 
> GUI update) is done in not shown code in the thread before Synchonize 
> is called.
thread code is all what you see above.
my intention was use thread only for periodical refresh of list

> Otherwise you just could use TTimer.
probably yes. I do not remember why I have used thread for it. May be I 
do not wanted dependency on ExtCtrls ...
Btw. when TTimer is executing OnTimer method, which does not finishes 
until next Interval is elapsed, is again called OnTimer ? Or next 
OnTimer is performed only when prior OnTimer finished ?


More information about the Lazarus mailing list