Re: Custom IB palette and menu item
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.