• 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: Can't anyone help me with PopUp Menus?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can't anyone help me with PopUp Menus?


  • Subject: Re: Can't anyone help me with PopUp Menus?
  • From: "Louis C. Sacha" <email@hidden>
  • Date: Wed, 4 Feb 2004 00:19:05 -0800

Hello...

Among other things, the basic problem seems to be that you should be calling Pop_Menu from an awakeFromNib method, and not from init.
Remove the [ self Pop_Menu ] line from your init, and put it in awakeFromNib.

If it still doesn't work, make sure that the pop up button is connected correctly to your object in interface builder.

Finally, NSPopUpButton has several styles, and either the popUp style or the pullDown style uses the first menu item as it's title and not in the menu (I don't remember offhand which one and don't have time to look it up at the moment). If the text you are inserting is showing up as the title of the menu, but not in the menu itself then you need to have an extra menu item as the first one that acts as the title.

- (void)awakeFromNib
{
if (!objectPop) {NSLog(@"I forgot to connect the popUpButton in InterfaceBuilder.");}
[self Pop_Menu];
}

Hope that helps...

Louis


Can someone please provide me with working code.

I realize everyone has a solution and offers me one line of code but after
more than a week not one offer recieved has been a working one.

I'd settle for one line of code that would place "This Works" (or any other
text) in an empty pop-up menu as long as it works.

My requirements are simple, it's a Cocoa app, it has a single window with an
empty pop-up menu, when you run the app it puts text in the pop-up menu, can
put more than one item if you prefer, I just need to see it work.

I'd settle for one line of code that would place "This Works" (or any other
text) in the empty pop-up menu as long as it works.

here is what I already have in code.
_______________________________________________

menu.h
_______________________________________________

#import <Cocoa/Cocoa.h>
#import <AppKit/AppKit.h>

@interface menu : NSObject
{
IBOutlet NSPopUpButton *objectPop;
CFStringRef appID;
}

- (id)init;
- (void) Pop_Menu;

@end
_______________________________________________

menu.m
_______________________________________________

#import "menu.h"

@implementation menu

-(id)init
{

extern id NSApp;
[NSApp setDelegate: self];
[ self Pop_Menu ];
return [super init];
}

- (void) Pop_Menu
{
/* put text in menu */

[objectPop addItemWithTitle:@"Test"];// this didn't work


}


@end
_______________________________________________

Someone has to know how to do this, please help someone out who can't figure
it out.

_______________________________________________
Best regards,
Mr. Dale Walsh
_______________________________________________
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.
_______________________________________________
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: 
 >Can't anyone help me with PopUp Menus? (From: email@hidden)

  • Prev by Date: Re: Removing text container from layout manager stops delegate messages
  • Next by Date: Re: Cocoa/Windows parallel dvlpmt
  • Previous by thread: Can't anyone help me with PopUp Menus?
  • Next by thread: Changing the signature of the application
  • Index(es):
    • Date
    • Thread