Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > contextual menus and focus rects

contextual menus and focus rects
Thread Tools
Mac Enthusiast
Join Date: Oct 2001
Status: Offline
Reply With Quote
Jun 11, 2003, 11:32 PM
 
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?
(Last edited by 3R1C; Nov 10, 2003 at 10:02 PM. )
3R1C
     
3R1C  (op)
Mac Enthusiast
Join Date: Oct 2001
Status: Offline
Reply With Quote
Jun 12, 2003, 12:47 AM
 
I just implemented my above scheme, and it DOES work, but it still seems to be a hackish way to accomplish it. Im still a fledgling developer so I dont really have any frame of reference to compare.
(Last edited by 3R1C; Nov 10, 2003 at 10:03 PM. )
3R1C
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 03:41 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2