tips
[Top] [All Lists]

REALbasic Tip: Making your user interface work during a long loop

To: REALbasic-tips at lists dot realsoftware dot com
Subject: REALbasic Tip: Making your user interface work during a long loop
From: Geoff Perlman <geoff at realsoftware dot com>
Date: Wed, 21 Apr 2004 13:03:21 -0500
Cc:
Delivered-to: REALbasic-tips at lists dot realsoftware dot com
List-help: <mailto:realbasic-tips-request@lists.realsoftware.com?subject=help>
List-id: REALbasic Tips <realbasic-tips.lists.realsoftware.com>
List-post: <mailto:realbasic-tips@lists.realsoftware.com>
When you have a long loop executing, your application's user interface is inaccessible. In the past, the only way around this problem was to execute the code from a timer or a thread. But there's another solution that doesn't require changing code so much.

In REALbasic 5.5 we added the DoEvents method to the Application class. This method simply yields time back to your application so that your user interface is still accessible. To use this method, simply call App.DoEvents during your loop. Note that the loop will take longer to execute with DoEvents so only use it when you really need your user interface to be accessible during a long loop.
--
Geoff Perlman
President and CEO
REAL Software, Inc.

<Prev in Thread] Current Thread [Next in Thread>
  • REALbasic Tip: Making your user interface work during a long loop, Geoff Perlman <=