:-)
Just like in Delphi. Txs.
I was refering to the demo used in the SQL lite tread. All do it was not
the problem he was facing it could lead to other problems if not used as
described in your wiki topic.


Met vriendelijke groet, 
Pieter Valentijn
 
Delphidreams
http://www.delphidreams.nl
 


-----Oorspronkelijk bericht-----
Van: Mattias Gaertner [mailto:[EMAIL PROTECTED] 
Verzonden: donderdag 18 januari 2007 15:47
Aan: [email protected]
Onderwerp: Re: [lazarus] Sugestion tread use for updating forms.


On Thu, 18 Jan 2007 15:23:10 +0100
"Pieter Valentijn" <[EMAIL PROTECTED]> wrote:

> I think the same functions are in Lazarus as in Delphi right ?

See
http://wiki.lazarus.freepascal.org/Multithreaded_Application_Tutorial


> i.e.
> 
> Somewhere global
> var
>   aThreadLock : TRTLCriticalSection ;
> 
> In any procedure that calls the treadlist or tread actions that must 
> finish before anny other actions take place you can use structures 
> like this.
> 
> 
>         EnterCriticalSection(aThreadLock );
>         try
>           try
>            tablo:=TSqlite3Dataset.Create(Nil);
>            tablo.FileName:='db/services.db';
>            tablo.SQL:= 'select type_name, server_ip from servers where

> id='+ inttostr( record_id) ;
>            tablo.Active:=True; 
>            type_name:= tablo.FieldByName('type_name').AsString;
>            server_ip:= tablo.FieldByName('server_ip').AsString;
>           except
>  
> main.StatusBar1.SimpleText:='thread1'+tablo.SqliteReturnString+tablo.S
> QL
> ;
>           end;
>         finally
>           LeaveCriticalSection(aThreadLock );
>         end;
>  end;
> 
> 
> I also gess lazars has the same Synchronize function like the one in 
> Delphi
> 
> There you get this hint tekst
> 
> "Important: Methods and properties of objects in visual components can

> only be
>   used in a method called using Synchronize, for example,
> 
>       Synchronize(UpdateCaption);
> 
>   and UpdateCaption could look like,
> 
>     procedure ADSLUpdThread.UpdateCaption;
>     begin
>       Form1.Caption := 'Updated in a thread';
>     end;"


Mattias

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to