• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Blocking loops
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Blocking loops


  • Subject: Blocking loops
  • From: email@hidden
  • Date: Fri, 16 Jun 2006 14:24:41 +0100

I've got an application that does a fair bit of processing in a while loop...

<Code>
NSString* currentObj;
NSEnumerator* allObjects = [myArray objectEnumerator];
while (currentObj = [allObjects nextObject]) {
    [progressBar setDoubleValue:((objIndex / [[fileController content] count]) *
100)];
    [progressBar setNeedsDisplay:YES];
    // Lots of processing here
} // while
</Code>

Unfortunately, the progress bar doesn't actually move (and the App is
unresponsive) until the loop completes. Is there a simple one line fix to this
(I'm thinking along the lines of Visual Basic's DoEvents() and Delphi's
Application.ProcessMessages()), or do I need to do some weird stuff involving
Notifications, and do away with (no pun intended) the loop?

Thanks for any help offered,

 - Drarok

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Blocking loops
      • From: Nicko van Someren <email@hidden>
    • Re: Blocking loops
      • From: Shawn Erickson <email@hidden>
  • Prev by Date: Re: Core Data insert an Url
  • Next by Date: Re: Blocking loops
  • Previous by thread: Animating a drag and insert operation
  • Next by thread: Re: Blocking loops
  • Index(es):
    • Date
    • Thread