by Gregory Weston <uce@[EMAIL PROTECTED]
>
Jul 1, 2008 at 10:56 AM
In article
<8b480d16-aafe-4baa-8b32-af0eac0fd1e7@[EMAIL PROTECTED]
>,
JoeG <joe.garifo@[EMAIL PROTECTED]
> wrote:
> I am writing a program that calculates the various scores needed to
> construct a DnD character. While doing the calculations, I ask the
> user what skills they want trained by popping up a dialog panel. I
> need to pause the rest of the calculations until the user pressed the
> button in the dialog giving his choice. Everything I have tried so far
> results in an infinite loop. Do I need to implement threading here, or
> is there another option? Any suggestions would be greatly appreciated.
> Thanks
This isn't the problem threading was invented to solve; it's really
almost the opposite. Essentially what you need to do is put the
calculations on hold while collecting the new input. Just cache whatever
you've got, display the dialog and let the normal event loop go. Then
use the dismissal of the dialog as the signal to retrieve your cached
information and resume the calc.
The specific technique for doing that depends on information about your
project which you haven't told us. The big question is: are you using
Carbon or Cocoa?
--
"Harry?" Ron's voice was a mere whisper. "Do you smell something ...
burning?"
- Harry Potter and the Odor of the Phoenix