Path: utzoo!attcan!uunet!kgw2!dennisg From: dennisg@kgw2.bwi.WEC.COM (Dennis Glatting) Newsgroups: comp.sys.next Subject: Re: How do I interrupt my App? Message-ID: <1872@kgw2.bwi.WEC.COM> Date: 5 Nov 90 13:44:22 GMT References: <1614@libra.cs.nps.navy.mil> Sender: dennisg@kgw2.bwi.WEC.COM Reply-To: dennisg@kgw2.bwi.WEC.COM Organization: Xetron Corporation, Cincinnati Ohio Lines: 35 In article <1614@libra.cs.nps.navy.mil>, sisk@libra.cs.nps.navy.mil (Tamara Sisk) writes: |> I'm polishing up a nifty App to submit to the sites, but I'm stuck on |> one thing. |> |> Part of the App involves creating a (very) long list in a ScrollView. |> I want to be able to stop the listing without crashing my App, once |> I'm happy with how long the list is. Currently, there is a "Start" button |> that starts the listing. I'd like to make it so that this button |> turns into a "Stop" button while the list is going, so that if |> I push it again, the method creating the list just stops, just like |> ScorePlayer, for example, whose start button turns into a stop button. |> |> The problem seems to be that my App won't respond to button pushes |> while the list-making method is working. I've tried messing around |> with [myButton setState:state] and things like this, but nothing |> in my App responds until this one method finishes. try going multi-threaded. this is your best solution. have a thread build a list while the other performs the normal App functions (button clicks, event loop processing, /etc, /etc, /etc). problem. two threads cannot draw at the same time. try disabling the display of the list, build it, indicate such to the main thread either through a speaker/listener or posting a user event. then exit. let the main thread update the display. also, when the main thread detects the "Stop" it could terminate the builder thread. in short. no problem. you just have to use your favorite cooperating process mechanism. -- ..!uunet!kgw2!dennisg | Dennis P. Glatting dennisg@kgw2.bwi.WEC.COM | X2NeXT developer