Newsgroups: comp.windows.interviews
Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!zaphod.mps.ohio-state.edu!van-bc!ubc-cs!uw-beaver!june.cs.washington.edu!lottis
From: lottis@cs.washington.edu (Kent David Lottis)
Subject: Polling a Dialog Box
Message-ID: <1991May24.015032.26058@beaver.cs.washington.edu>
Summary: How to cancel long-running functions
Originator: lottis@june.cs.washington.edu
Sender: news@beaver.cs.washington.edu (USENET News System)
Organization: Computer Science & Engineering, U. of Washington, Seattle
Date: Fri, 24 May 91 01:50:32 GMT

Dumb question (maybe) from an InterViews (and windowing system programming
in general) beginner.

I'm using a mutated version of idraw as the front end for a testbed
for polygon-packing algorithms. It's kind of neat - you draw a
bunch of polygons, drop down a Solver menu from the Command bar and
select your favorite polygon-packing algorithm. Click and
then sit back and watch.

Here's my problem: some of these algorithms can take quite a while
to run and sometime's I'd like to be able to abort them. At this
point, this requires killing the process. Ugh!.

What I _tried_ to do was create a simple "Cancel" dialog box.
The idea is that this box would stay up for as long as the 
algorithm runs and then disappear. 
I _thought_ that all I had to do was to put a line 
in the "main loop" of the algorithm that polled the dialog box
to see if it had caught any down events.

This doesn't seem to work. I click away and the algorithm just
keeps going.

Have I basically the right idea, but an implementation bug? Or
does this problem require an entirely diffent solution?


Brief pointers could be posted,
Pedantic lectures are welcome (I'll take all I can get) but mail them
 to save bandwidth.

============================================
Kent Lottis
lottis@cs.washington.edu

Disclaimer - "I wish I had an employer to speak for".

