On 19/11/2012 11:43, Michael Schnell wrote:
On 11/19/2012 10:08 AM, Eric Kom wrote:

after included the Crt library in my lazarus file, when I called the functions sleep() or delay(), the function do not execute the previous statement, pass and execute the next as below:

StatusBar.SimpleText := 'My name is Tux';
sleep(100);
StatusBar.SimpleText := 'am ready';


Using sleep in this way does not make sense at all.

- Any GUI action (i.e. displaying changes) is blocked while the main is sleeping. - the GUI actions are performed by events and can will be performed at "some reasonable point in time" after the action is scheduled by the user program.
the Connection procedure is declared as a private

procedure Tfrmform1.Connection(Sender: TObject);
begin
    StatusBar.SimpleText := 'My name is Tux';
    sleep(100);
    StatusBar.SimpleText := 'am ready';
end;

The purpose of sleep() is nothing but "allowing for other threads and processes to use the CPU for at least the given milliseconds".

-Michael

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus



--
Kind Regards

Eric Kom

System Administrator - Metropolitan College
 _________________________________________
/ You are scrupulously honest, frank, and \
| straightforward. Therefore you have few |
\ friends.                                /
 -----------------------------------------
   \
    \
        .--.
       |o_o |
       |:_/ |
      //   \ \
     (| Kom | )
    /'\_   _/`\
    \___)=(___/

2 Hennie Van Till, White River, 1240
Tel: 013 750 2255 | Fax: 013 750 0105 | Cell: 078 879 1334
[email protected] | [email protected]
www.kom.za.net | www.kom.za.org | www.erickom.co.za

Key fingerprint: 513E E91A C243 3020 8735 09BB 2DBC 5AD7 A9DA 1EF5


--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to