• 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: [ot/newbie] Changing init code of widgets in Interface Builder
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ot/newbie] Changing init code of widgets in Interface Builder


  • Subject: Re: [ot/newbie] Changing init code of widgets in Interface Builder
  • From: Esteban <email@hidden>
  • Date: Thu, 6 Jun 2002 00:47:10 -0700

You might not need to subclass at all. Instead write a routine that puts the the info into the NSPopUpButtons by calling addItemsWithTitles:(NSArray *)itemTitles. Then just hook up an action to the NSPopUpButtons.

You might also instead want to create your own NSMenu and set it to be the NSPopUpButtons menu by calling setMenu.

-Esteban

On Thursday, June 6, 2002, at 12:32 AM, Carl Gherardi wrote:

Hi,

I've got a series of drop down menus in my main application window that i'd
like to "fill" with menus from a preference file during startup.

Do I need to subclass NSPopUpButton and add it to the interface or can I
edit something else to add initialization code?

On the same note, I've subclassed NSView and I want to set up some default
values for variables fo the class.

I (think I) have correctly attempted to override init, but even:

- (void)/(id)init
{
NSLog(@"NSView subclass instantiating");
}

doens't print a thing.

I've (temporarily) got around the problem by placing the init code in a
block

- (void)drawRect:(NSRect)rect
{
if(!blah)
{
blah++;
//init data structures here
}
//Drawing stuff here
}

Pointers much appreciated (as were the last set :)

Thanks

Carl
_______________________________________________
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.

  • Prev by Date: Re: Any way to draw a PixMapHandle into an NSView??
  • Next by Date: Re: Killing child tasks
  • Previous by thread: [ot/newbie] Changing init code of widgets in Interface Builder
  • Next by thread: Re: [ot/newbie] Changing init code of widgets in Interface Builder
  • Index(es):
    • Date
    • Thread