Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!dali.cs.montana.edu!milton!wiml From: wiml@milton.u.washington.edu (William Lewis) Newsgroups: comp.sys.next Subject: Re: How do I interrupt my App? Summary: Modal sessions Message-ID: <10705@milton.u.washington.edu> Date: 7 Nov 90 06:03:13 GMT References: <1614@libra.cs.nps.navy.mil> Organization: University of Washington, Seattle Lines: 41 In article <1614@libra.cs.nps.navy.mil> sisk@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. > >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. That's because while you're doing your processing, the event loop is basically stoped (waiting for your methodto return), not processing mouse events or redrawing the windows. If you don't want to go the route of multiple threads (as suggested by another poster), you could try a modal loop. The Application class has a bunch of methods for things like this. What you want is (if I remember correctly) startModalSessionFor:. There are four or so methods that do this that operate on (NXSession *)s. The stated purpose is so that the app can do timeconsuming things but still allow the user to stop them via button presses. (Sounds familiar, no?) You basically poll the event queue periodically by calling these methods, and NXApp will call your button's target if necessary, so it can set a flag (or maybe there's a way to make the polling method return maningful values). >Oh, and by the way, how will I go about submitting this to the ftp >sites once I fix this "last bug?" Last I checked, you can: (1) upload to the submissions directory if it's writeable (2) send mail to the site's keeper so they notice, I guess you'd include the app uuencoded if you couldn't do (1) Hope to see your application in the archives soon! =8) -- wiml@milton.acs.washington.edu Seattle, Washington (William Lewis) | 47 41' 15" N 122 42' 58" W "These 2 cents will cost the net thousands upon thousands of dollars to send everywhere. Are you sure you want to do this?"