• 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
can the button responce the second click before the first is finished before?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

can the button responce the second click before the first is finished before?


  • Subject: can the button responce the second click before the first is finished before?
  • From: XiaoGang Li <email@hidden>
  • Date: Wed, 28 Oct 2009 17:19:29 +0800

when user click the OK button, the application will fall into a for loop for
a long time, how to jump out the for loop without using multi-threads? like
this:

BOOL bStop = NO;

- (IBAction)okButton:(id)sender
{
     //user can click the button again to stop the action to continue.
     [okButton setTitle:@"Stop"];
     [okButton displayIfNeeded];

     //N is a big number, and the doSomething method is a time consumer too.
     for(int i=0; i<N && !bStop; i++)
     {
          [self doSomething];
     }
     bStop = YES;
}

the problem is that when the application begain to execute the action, the
mousr will begain to busy state, and apparently the okButton can not
response again.
when user click the ok button (titled Stop) again, the application need to
jump out the for loop if the bStop flag changed to YES. How to implement it?


thanks.
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: can the button responce the second click before the first is finished before?
      • From: Alexander Spohr <email@hidden>
  • Prev by Date: Re: outline view with mail style folder counts in rounded rectangle
  • Next by Date: Re: Problem with allocating memory
  • Previous by thread: Re: Adding new Core Data objects through a form
  • Next by thread: Re: can the button responce the second click before the first is finished before?
  • Index(es):
    • Date
    • Thread