Results 1 to 2 of 2

Thread: [LAZARUS] Alternate to Sleep()?

  1. #1
    Join Date
    Jun 2012
    Posts
    2,182
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default [LAZARUS] Alternate to Sleep()?

    When making apps in lazarus, whenever I use sleep, it does weird things. For example, I can't close the screen while its sleeping, I can't resize it, no Onclick events can be called, everything freezes for however long it's sleeping. Is there an alternative to sleep that will still keep everything functional?

    Thanks
    Footy

    E: Found this suggestion online. The only downside is when I am moving a screen, everything stops, but atleast it's better then it was.

    Code:
    Procedure FSleep(Time : Integer);
    var
      i:integer;
    begin
      for i := 0 to Time do
        begin
          sleep(1);
          Application.ProcessMessages;
        end;
    end;
    Last edited by Footy; 11-26-2012 at 09:04 PM.
    Thx Euphemism and Vinyl for the awesome siggy and avatar!

  2. #2
    Join Date
    Nov 2006
    Posts
    1,103
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    to prevent the counting to stop you could have it loop untill time passed is big enough, rather than sleep(1) as many ms as you would like to sleep
    Infractions, reputation, reflection, the dark side of scripting, they are.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •