In the finder, when a user pops up the contextual menu, whatever is clicked on has a focus rect drawn around it. with the help of this forum ive been successful in getting this focus rect to draw around a row in my table when the user pops up the context menu for an item that is not the current selection.
there is still much to do to get my context menus to bahave as apples do, but ill stick to one hurdle at a time.
to get my focus rect to draw, i draw it in my tableView subclass :
- (NSMenu *)menuForEvent:(NSEvent *)event
this menu is created on the fly and autreleased. works like a champ. now how do i get the focus rect to go away? i know that i just need to tell my table to redraw itself but where do i tell it to?
the only thing i can think of is to subclass NSMenu and override dealloc and post a notification in dealloc. so that after the menu is dismissed and dealloc gets called, i listen for the "menuWentAway" notification i posted. when i get this notification, i could tell my table to display, thus clearing my focus rect. sounds kinda hacky to me, but i cant think of any other way to do it. how do ya'll speculate that apple does it?