• 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: Custom IB palette and menu item
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Custom IB palette and menu item


  • Subject: Re: Custom IB palette and menu item
  • From: Chuck Fleming <email@hidden>
  • Date: Tue, 3 Feb 2004 14:15:21 -0800

Hi,

Try something like this.

- (void)finishInstantiate
{
NSMenuItem *menuItem = [[NSMenuItem alloc] initWithTitle:@"F-Script"
action:@selector(submenuAction:) keyEquivalent:@""];
NSMenu *submenu = [[NSMenu alloc] initWithTitle:@"Submenu"];
NSMenuItem *item1 = [[NSMenuItem alloc] initWithTitle:@"item1"
action:@selector(orderFront:) keyEquivalent:@""];
[submenu addItem:item1];
[menuItem setSubmenu:submenu];

[[self paletteDocument] attachObject:submenu toParent:menuItem];
[[self paletteDocument] attachObject:item1 toParent:submenu];

[self associateObject:menuItem ofType:@"IBMenuItemPboardType"
withView:menuImageView];
}

BTW, without the code for attaching objects, your F-Script item won't
be fully functional in the submenus either (the submenu and it's item
will be missing).

Chuck


> From: Philippe Mougin <email@hidden>
> Date: January 28, 2004 10:19:14 AM PST
> To: email@hidden
> Subject: Custom IB palette and menu item
>
> I have created an Interface Builder palette containing a menu item
> with a submenu inside. To create this palette, I started from the
> code provided by Apple in
> /Developer/Examples/InterfaceBuilder/BusyPalette.
>
> It works well except that, in IB, I cannot drag my menu item from my
> palette and drop it in the top-level menu of the application being
> designed within IB. I can however drop it in a sub-menu (like the File
> menu, the Edit menu etc.)
>
> There must be something special to do in order to make the top-level
> menu accept my palletized menu item in the way it accepts menu items
> from the standard "Menus" Interface Builder palette.
>
> Any hints?
>
> Best,
>
> Phil
_______________________________________________
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: Swapping the NSTextContainer on an NSTextView
  • Next by Date: Download a RTFD file
  • Previous by thread: How many files?
  • Next by thread: Download a RTFD file
  • Index(es):
    • Date
    • Thread