Select the first item of a NSPopUpButtonCell's new menu

This commit is contained in:
Wolfgang Lux 2022-02-26 15:30:26 +01:00
parent ec3353ecd8
commit efb9bcb2e7
2 changed files with 7 additions and 2 deletions

View file

@ -210,8 +210,9 @@ static NSImage *_pbc_image[5];
[self setMenuView: nil];
}
// FIXME: Select the first or last item?
[self selectItemAtIndex: [_menu numberOfItems] - 1];
// Select the first item because that is the only selection that makes
// sense for pull downs.
[self selectItemAtIndex: [_menu numberOfItems] > 0 ? 0 : - 1];
[self synchronizeTitleAndSelectedItem];
}