Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Programmatically setting action of a button



Hi,
[newButton setTarget:self];
No ?
Guillaume



Selon Matthias Winkelmann <email@hidden>:

> Hi,
>
> I'm having a little problem with setting the action for a button. I
> have a custom view which adds some buttons like this:
>
> NSButton *newButton = [[NSButton alloc] initWithFrame:frame];
> [newButton setTitle:caption];
> [newButton setImage:newImage];
> [newButton setAction:@selector(someAction:)];
> [self addSubview:newButton];
>
> In the same class I added someAction:
>
> - (IBAction)someAction:(id)sender;
>
> The buttons are rendered correctly, but the Action is apparently
> never called. Any ideas?
>
> thanks,
>
> Matthias
>  _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list      (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/email@hidden
>
> This email sent to email@hidden
>


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden

References: 
 >Programmatically setting action of a button (From: Matthias Winkelmann <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.