Newsgroups: comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!bb3.andrew.cmu.edu!newsfeed.pitt.edu!godot.cc.duq.edu!newsgate.duke.edu!news.mathworks.com!newsfeed.internetmci.com!usenet.eel.ufl.edu!psgrain!qiclab.scn.rain.com!gemstone.com!servio!servio!aland
From: aland@servio.slc.com (Alan Darlington)
Subject: Re: Newbie in search of event handler
Message-ID: <1996Jul8.190243.22264@gemstone.com>
Sender: news@gemstone.com (USENET News)
Nntp-Posting-Host: servio
Organization: GemStone Systems, Inc., Beaverton OR, USA
References: <4rdo6p$5rc@uruguay.it.earthlink.net> <31DAAE7B.715@terracom.net> <4rj1qu$1cm@paraguay.it.earthlink.net>
Date: Mon, 8 Jul 1996 19:02:43 GMT
Lines: 32

dwarren@earthlink.net writes:
<snip>
> Perhaps I didn't pose the question clearly enough.  Button A starts a
> long, involved calculation (I described it as an "infinite loop," but
> it's better thought of as, say, calculating the first 1,000,000
> primes, or a sort of a huge file).  That seems to consume all the
> system's attention.
> 
> I've seen the same thing in VB and Delphi, and there are special
> methods to call to get the system to look for other events each time
> around the loop.  I've put static text elements on the form just for
> testing, one that is set when button A sets the process to "running",
> the other that reads to the effect "stop requested" when button B is
> pressed to interrupt the thing.  Once the process starts running,
> button B's message doesn't register until button A's process is over.
> 
> I'd thought that maybe something involving the use of Semaphore would
> be needed to force attention to other events once button A's process
> gets the attention of the processor.  But if you say not, maybe not.

I have looked at a window somebody here did that seems to solve your
problem (at least it is worth looking at :-).  Button A starts the
process (in our case, a long test case involving our product).  But,
it starts it as a _separate thread_, which it caches in an instance
variable.  This means that the thread which runs the window remains
open to external events.  When you press button B, it (optionally)
kills the thread started by button A.  Of course, this may depend
somewhat on which flavor (or flavour) of Smalltalk you are running.

  Cheers,
  Alan
    (standard disclaimer)
