Tim Hart wrote:


On Thursday, February 27, 2003, at 04:47 PM, Richard Gaskin wrote:


Ctrl-. (Win) or Cmd-. (Mac).

Thanks. Now how do I do that with a button labeled "reset" so the user can do it to.

That's not so easy. I did it once for WebMerge, and maybe there's a simpler way but my method ate a lot of clock cycles.

I called a function in my repeat loop that checked the mouseLoc, and if it
was over the Cancel button it turned the cursor from watch to hand.  Then it
checked if the mouse was down, and if so it sent a "mouseUp" to that button.
With the overhead of event polling, this dragged my app's performance down
dramatically.

In a later version I simply removed the button and replaced it with a note
for the user to type Ctrl-. to cancel, and commented out the function call:
My app was now much faster, and not a single user has ever even noted the
change, other than to express their appreciation for the speed increase.

Anyone have an efficient way of implementing a Cancel button from within a
loop?

Cancelling with cmd-. is routine on the mac, though I don't know about windows. I would just set allowInterruption to false while running the handler (so MC does not hop in with its dialog which is likely to confuse users) and use the interrupt function at reasonable intervals to check for cancellation request.


Robert Brenstein
_______________________________________________
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to