• 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: NSPopUpButton not accepting setMenu: from WindowController code
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSPopUpButton not accepting setMenu: from WindowController code


  • Subject: Re: NSPopUpButton not accepting setMenu: from WindowController code
  • From: Keary Suska <email@hidden>
  • Date: Sat, 18 Feb 2012 10:55:07 -0700

On Feb 18, 2012, at 8:37 AM, Erik Stainsby wrote:

>
> [myPUBtn setMenu:menu] accepted in MyAppDelegate but does not accept setMenu:menu when relocated to an NSWindowController.  I'm thinking there is something I have missed about the loading sequence.

When you call this method, what object do you pass as "owner"? Is the outlet connected from the File's Owner, or an object in the same xib?

> - (id)initWithWindowNibName:(NSString *)windowNibName owner:(id)owner {
>    self = [super initWithWindowNibName:windowNibName owner:owner];
>    if (self) {
> 	[self setActionPlugins:[self loadPluginsWithPrefix:@"Action"]];
>    }
>    return self;
> }
>
>
> - (void)windowDidLoad
> {
>    [super windowDidLoad];
> 	NSMenu * menu = [[NSMenu alloc] init];
>
> 	for(RSTrixiePlugin * p in actionPlugins)
> 	{
> 		NSMenuItem * menuItem = [[NSMenuItem alloc] initWithTitle:[p name] action:@selector(showActionPlugin:) keyEquivalent:@""];
> 		[menuItem setRepresentedObject:p];
> 		[menu addItem:menuItem];
> 		NSLog(@"%s- [d] added action menu item for plugin: %@", __PRETTY_FUNCTION__, __LINE__, [p name]);
> 	}
> 	[actionMenu setMenu:menu];
> 	NSLog(@"%s- [d] %@", __PRETTY_FUNCTION__, __LINE__, menu);		// shows description of populated menu
> 	NSLog(@"%s- [d] %lu", __PRETTY_FUNCTION__, __LINE__, [[menu itemArray] count]);		// returns 2
> 	NSLog(@"%s- [d] %lu", __PRETTY_FUNCTION__, __LINE__, [[[actionMenu menu] itemArray] count]);  // returns 2
> 	NSLog(@"%s- [d] %@", __PRETTY_FUNCTION__, __LINE__, [actionMenu menu]);  // (null)
> 	[actionMenu setNeedsDisplay:YES];  // on a whim
> }
>
>
> […]
>
>
>
> _______________________________________________
>
> 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


Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"


_______________________________________________

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: NSPopUpButton not accepting setMenu: from WindowController code
      • From: Erik Stainsby <email@hidden>
References: 
 >NSPopUpButton not accepting setMenu: from WindowController code (From: Erik Stainsby <email@hidden>)

  • Prev by Date: Re: __block __weak - am I doing this right?
  • Next by Date: Re: NSPopUpButton not accepting setMenu: from WindowController code
  • Previous by thread: NSPopUpButton not accepting setMenu: from WindowController code
  • Next by thread: Re: NSPopUpButton not accepting setMenu: from WindowController code
  • Index(es):
    • Date
    • Thread