Hi Fred,

*NSPopUpButtonCell*

- (void)synchronizeTitleAndSelectedItem
{
int index;

if (!_pbcFlags.usesItemFromMenu) return;

if ([_menu numberOfItems] == 0)
{
index = -1;
}
else if (_pbcFlags.pullsDown)
{
index = 0;
}
else
{
index = [[_menu menuRepresentation] highlightedItemIndex];
if (index < 0) index = [self indexOfSelectedItem];
// if (index < 0) index = 0; // <--------------- this is bad
}

if ((index >= 0) && ([_menu numberOfItems] > index))
{
NSMenuItem *anItem;


// This conversion is needed as [setMenuItem:] expects an NSMenuItem
anItem = (NSMenuItem *)[_menu itemAtIndex: index];
[self setMenuItem: anItem];
}
else
{
[self setMenuItem: nil];
}
}

Here our implementations matches the specification, why should we
deviate from that?

Because the behaviour is simply wrong.

selectItem:
- (void)selectItem(id <NSMenuItem>)anObject

Selects the menu item
anObject in the pop-up menu. If anObject is nil, all items in the menu are deselected (this is a technique for obtaining a pop-up menu with no items selected).


When I send selectItem:nil to a NSPopUp I want the selection to vanish. This works on MacOSX as it should. On GNUstep the above mentioned line prevents the correct behaviour.

Regards,

Andreas





_______________________________________________
Discuss-gnustep mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/discuss-gnustep

Reply via email to