• 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
Re: [newbie] Updating an NSProgressIndicator in a for loop
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [newbie] Updating an NSProgressIndicator in a for loop


  • Subject: Re: [newbie] Updating an NSProgressIndicator in a for loop
  • From: Thomas Lachand-Robert <email@hidden>
  • Date: Sun, 9 Mar 2003 09:50:19 +0100

Le dimanche, 9 mars 2003, ` 02:38 Europe/Paris, Mike Benonis a icrit :

Hi,
I'm working on a little program that updates an NSProgressIndicator in a
tight for loop. However, the drawing doesn't occur until the loop is
finished, whish isn't really helpful. Is there an equivalent of REALbasic's
ProgressBar.Refresh and/or Window.Refresh message in Cocoa to force a screen
update immediately (even at the cost of speed)?


You don't need to ask the progress bar to refresh: it will do so automatically if you change its value. However, if you are in a "tight for loop", you probably don't give any chance to the drawing to occur. Your program should either go out of the loop regularly to return to the main loop, where drawing updates occur, or be multithreaded.

So if your loop can easily be broken in small parts, I suggest you do so and return regularly, then back to the loop (using performSelector:afterDelay: or an NSTimer). Otherwise, you could use another thread for your computation (this is a complicated subject, see the doc and many discussions here about that). If you only want to display the progress indicator, take a look at setUsesThreadedAnimation: which is probably the easiest solution in your case.

Yours,


Thomas Lachand-Robert
********************** email@hidden
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >[newbie] Updating an NSProgressIndicator in a for loop (From: Mike Benonis <email@hidden>)

  • Prev by Date: Re: Shared Memory and Distributed Objects
  • Next by Date: Re: Safari Plugins?
  • Previous by thread: Re: [newbie] Updating an NSProgressIndicator in a for loop
  • Next by thread: Safari Plugins?
  • Index(es):
    • Date
    • Thread