From 4ebfd919969216165d3e94d41e21fd1456d9c8df Mon Sep 17 00:00:00 2001 From: FredKiefer Date: Thu, 30 Aug 2001 06:50:38 +0000 Subject: [PATCH] In [insertItemWithTitle:atIndex:] use action and target from the cell for menu item. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@10803 72102866-910b-0410-8b05-ffd578937521 --- Source/NSPopUpButtonCell.m | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Source/NSPopUpButtonCell.m b/Source/NSPopUpButtonCell.m index 104a425ef..c7fac8d14 100644 --- a/Source/NSPopUpButtonCell.m +++ b/Source/NSPopUpButtonCell.m @@ -182,7 +182,7 @@ static NSImage *_pbc_image[2]; - (void) insertItemWithTitle: (NSString *)title atIndex: (int)index { - NSMenuItem *anItem = [NSMenuItem new]; + NSMenuItem *anItem; NSMenuItemCell *aCell; int count = [_menu numberOfItems]; @@ -191,13 +191,11 @@ static NSImage *_pbc_image[2]; if (index > count) index = count; - [anItem setTitle: title]; - [anItem setTarget: nil]; - [anItem setAction: NULL]; - - [_menu insertItem: anItem atIndex: index]; - - RELEASE(anItem); + anItem = [_menu insertItemWithTitle: title + action: [self action] + keyEquivalent: @"" + atIndex: index]; + [anItem setTarget: [self target]]; aCell = [[_menu menuRepresentation] menuItemCellForItemAtIndex: index]; [aCell setBelongsToPopUpButton: YES];