Re: NSToolbarGroupItem not showing labels of subitems
Re: NSToolbarGroupItem not showing labels of subitems
- Subject: Re: NSToolbarGroupItem not showing labels of subitems
- From: Peter Ammon <email@hidden>
- Date: Mon, 5 Oct 2009 13:10:50 -0700
Hi Brad,
The group item will use its own label, if it has been set. Probably
creating the toolbar in IB caused the item to acquire an empty label.
Calling [groupItem setLabel:nil] should cause it to discard its own
label and use its children.
Let me know if that doesn't work,
-Peter
On Oct 5, 2009, at 10:06 AM, Brad Gibbs wrote:
Hi,
I'm trying to create a toolbar with NSSegmentedControl as a custom
view for an NSToolbarItemGroup in 10.6, but I can't get the labels
for the subitems to appear.
I added an NSSegmentedControl to the toolbar item in IB and set
images in the segmented control in IB. I did not give the
NSToolbarGroupItem a label.
I added the following code to my appDelegate (oProjectsGroup is an
IBOutlet, which is bound to the NSToolbarGroupItem in IB):
- (void)applicationDidFinishLaunching:(NSNotification *)
aNotification {
// Insert code here to initialize your application
NSToolbarItem *item1 = [[[NSToolbarItem alloc]
initWithItemIdentifier:@"Item1"] autorelease];
NSToolbarItem *item2 = [[[NSToolbarItem alloc]
initWithItemIdentifier:@"Item2"] autorelease];
[item1 setImage:[NSImage imageNamed:@"Activities"]];
[item2 setImage:[NSImage imageNamed:@"Projects"]];
[item1 setLabel:@"Prev"];
[item2 setLabel:@"Next"];
[oProjectsGroup setSubitems:[NSArray arrayWithObjects:item1, item2,
nil]];
for (id item in [oProjectsGroup subitems]) {
NSLog(@"label is %@", [item label]);
}
}
The console displays the labels, so, apparently, the labels are
being set, but they do not appear beneath their respective segments
in the running app.
I've looked through the documentation and a list thread both of
which seem to indicate that my code should be working....
Any help would be appreciated.
Thanks.
Brad
_______________________________________________
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
_______________________________________________
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