Newbie Q: wait
Ned Konz
ned at bike-nomad.com
Sun Jul 13 02:08:40 UTC 2003
On Saturday 12 July 2003 06:48 pm, Bilal Ahmed wrote:
> Hi,
>
> The following code creates a desirable delay between consecutive
> stimuli in an application I'm developing:
>
> (Delay forSeconds: 3) wait.
>
> However, I'd like for the user to be able to quit the application
> at any time, so I have added a quit button. However, this doesn't
> work seemingly because of the fact that when the system is waiting,
> it cannot sense the button being pushed. Is there any way I can
> work around this so that anything pressed during the wait can be
> recieved and either interrupt the wait, or end the application
> after the wait is over?
>
> Any ideas are most appreciated (and thanks Edgar for your input so
> far!)
You don't say what kind of UI you've made, but in general, you should
never Delay in the UI task. There's simply no reason to do so, and it
messes other things up.
So you have a few choices:
* Assuming you're using Morphic, use a step method. It doesn't have to
be to a Morph; you can tell the World to start stepping any arbitrary
selector with arbitrary arguments at a given rate. This is much
better and the rest of the UI will still work.
* Make a background task, and then arrange to communicate between it
and the user interface somehow. This will still probably either
require stepping on the Morphic side or addDeferredUIMessage: (look
up senders of it).
--
Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE
More information about the Squeak-dev
mailing list
|