• 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: NSProgressIndicator -- delete the first message with same title
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSProgressIndicator -- delete the first message with same title


  • Subject: Re: NSProgressIndicator -- delete the first message with same title
  • From: Jens Alfke <email@hidden>
  • Date: Fri, 23 May 2008 09:11:23 -0700


On 23 May '08, at 4:43 AM, John Love wrote:

Changing the spin method to look like:

- (void) spinIt:(BOOL)begin {
   if (begin)  [spinner startAnimation:nil];
   else        [spinner stopAnimation:nil];
}

Looks good.

@interface MyDocument:NSDocument
{
   IBOutlet Controller *theControl;
}
@end

This is fine, assuming you still have a 'Controller' object in your nib and you wire the MyDocument instance's 'theControl' outlet to point to it.


- (id) init {
   if (self = [super init]) {
       theControl = [[Controller alloc] init];
   }

   return self;
}

This part is wrong. If theControl is an IBOutlet, that means it's a pointer to an object in the nib, which will be set up for you by the nib when it loads. Assigning to it doesn't make any sense, generally. (Especially because your -init method runs before the nib sets up outlets, so whatever you assign here will be overwritten.)


Also, if you create a Controller object from scratch at runtime, that Controller won't have a spinner, since (I assume) its 'spinner' variable is an IBOutlet wired to a control in the nib. That only gets set up if there's a Controller instance in the nib, with that outlet wired up, and you use that instance.

What you want to do, I think, is to go back to the earlier working version, and replace the Controller's -spin method with your new one. Then add the 'theControl' outlet to your MyDocument class, as you already did, and wire it up in IB. That's all you need.

Now in your MyDocument methods, you can simply call [theControl spinIt: YES].

—Jens

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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

References: 
 >NSProgressIndicator -- delete the first message with same title (From: "John Love" <email@hidden>)

  • Prev by Date: Re: NSBrower selectedCells lies
  • Next by Date: Re: check if app opens with a document on startup
  • Previous by thread: Re: 'Configure Sheet' fails when containing a WebView
  • Next by thread: RE: programmatically changing IKImageView's tool mode?
  • Index(es):
    • Date
    • Thread