FAQFAQ   SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log in/Register/PasswordLog in/Register/Password

Delay help

 
   Mac (Home) -> Programmer Help RSS
Related Topics:
How to type in ASCII? - Stupid question #2 of the week. I'm trying to avoid writing a printer driver for a barcode label printer. It responds to commands, and I want to embed a command in a page that tells the printer to cut the paper. It's o STX, of course..

applications and windows - Hello. I'm primarily a system unix one. Currently I have to implement the following logic: On Mac OS X enumerate all running only those that are windows. Find which of them is where is defined as..

[ANN] Vice - Graphical Program Priority Adjustment Tool fo.. - Vice is an that allows the user to adjust the priority of programs running on Mac OS X. Normal users can lower the priority of their own programs, while can adjust the priority of any..

NSCursorAttributeName and NSTextView - Well, I've been playing around a little bit with getting URLs in my to actually become clickable links. So far, so good. I set the for my strings that get inserted into the text view: for the link..

adding graphics to my console app - I need to add to my UI, C code). This just means being able to open a window and display data in graphical format. I have a couple of options: 1. Dredge up ancient QuickDraw code I..
Next:  Programmer Help: link X11 automatically  
Author Message
JoeG

External


Since: Jun 30, 2008
Posts: 2



(Msg. 1) Posted: Mon Jun 30, 2008 7:51 pm
Post subject: Delay help
Archived from groups: comp>sys>mac>programmer>help (more info?)

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
Back to top
Login to vote
Gregory Weston

External


Since: Jun 06, 2005
Posts: 481



(Msg. 2) Posted: Tue Jul 01, 2008 10:56 am
Post subject: Re: Delay help [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article
<8b480d16-aafe-4baa-8b32-af0eac0fd1e7.TakeThisOut@27g2000hsf.googlegroups.com>,
JoeG <joe.garifo.TakeThisOut@gmail.com> 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
Back to top
Login to vote
JoeG

External


Since: Jun 30, 2008
Posts: 2



(Msg. 3) Posted: Wed Jul 02, 2008 6:54 am
Post subject: Re: Delay help [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Jul 1, 10:56 am, Gregory Weston <u....RemoveThis@splook.com> wrote:
> In article
> <8b480d16-aafe-4baa-8b32-af0eac0fd....RemoveThis@27g2000hsf.googlegroups.com>,
>
>  JoeG <joe.gar....RemoveThis@gmail.com> 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

I am using Cocoa and Xcode 3.0 to do this. This is also the first time
I've used Cocoa and Objective C to do this kind of project.
Back to top
Login to vote
Gregory Weston

External


Since: Jun 06, 2005
Posts: 481



(Msg. 4) Posted: Wed Jul 02, 2008 2:42 pm
Post subject: Re: Delay help [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article
<952e0b15-fd92-4795-966e-5e6b8b53433d.RemoveThis@m36g2000hse.googlegroups.com>,
JoeG <joe.garifo.RemoveThis@gmail.com> wrote:

> On Jul 1, 10:56 am, Gregory Weston <u....RemoveThis@splook.com> wrote:
> > In article
> > <8b480d16-aafe-4baa-8b32-af0eac0fd....RemoveThis@27g2000hsf.googlegroups.com>,
> >
> >  JoeG <joe.gar....RemoveThis@gmail.com> 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?
>
> I am using Cocoa and Xcode 3.0 to do this. This is also the first time
> I've used Cocoa and Objective C to do this kind of project.

So do as much work as you can/want-to up front, cache your data and/or
partial results, display the sheet, and have the did-end method you
designated gather the rest of the data from the sheet and kick off the
next phase of the calculation.

<http://developer.apple.com/documentation/Cocoa/Conceptual/Sheets/Tasks/U
singCustomSheets.html#//apple_ref/doc/uid/20001290>

I'm not sure how to take the "to do this kind of project" phrase. If
you're fairly new to Objective-C, I'd recommend you spend the money to
get a copy of Aaron Hillegass' "Cocoa Programming for Mac OS X."

<http://www.bookpool.com/ss?qs=0321503619>

--
"Harry?" Ron's voice was a mere whisper. "Do you smell something ... burning?"
- Harry Potter and the Odor of the Phoenix
Back to top
Login to vote
Simon Slavin

External


Since: Aug 24, 2005
Posts: 113



(Msg. 5) Posted: Thu Jul 03, 2008 9:20 pm
Post subject: Re: Delay help [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On 30/06/2008, JoeG wrote in message <8b480d16-aafe-4baa-8b32-
af0eac0fd1e7 RemoveThis @27g2000hsf.googlegroups.com>:

> 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.

I don't understand why you need to pause the calculations just for that
period of time. Either you have the details you need, in which case you
may as well complete them, or you don't, in which case why start them ?

Simon.
--
http://www.hearsay.demon.co.uk
Back to top
Login to vote
Display posts from previous:   
       Mac (Home) -> Programmer Help All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum
Categories:
 Windows Forums
 Game Forums
 Linux Forums
  Mac Forums
 PDA Forums
 Mobile Forums
  Top  |  Store  |  RSS Feeds RSS  |  Data Feeds  |  Advertise  |  Submit  |  Bookmark  |  Newsletter  |  Contact