NSTableView with NSPopupButtonCell and long menu -- how to scroll to selected item
NSTableView with NSPopupButtonCell and long menu -- how to scroll to selected item
- Subject: NSTableView with NSPopupButtonCell and long menu -- how to scroll to selected item
- From: Glenn Zelniker <email@hidden>
- Date: Mon, 18 Sep 2006 01:47:55 -0400
I have a table with a popup button as a data cell and there are many,
many items (as many as 256) in the popup button's associated menu.
I'd like the menu to scroll to the selected item in the menu when the
user clicks the menu, but I can't quite figure out how to do it. I'm
using numberOfItemsInMenu and menu:UpdateItem:atIndex:shouldCancel to
populate the menu and this works fine. But I can't figure out the
right point in the process of populating the menu that I should
invoke -selectItemAtIndex on the popup button that "owns" the menu.
I've set up a handler for NSPopUpButtonCellWillPopUpNotification, but
this notification seems to get called before the menu gets populated
and I get an exception when I try to select the desired item in the
menu. I've looked at using NSMenuDidAddItemNotification but it's a
bit of a pain doing it this way. Is there perhaps a notification that
gets posted when the menu is finished being populated? Or is there a
better way to go about what I'm trying to do?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden