• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSTableView lost focus detection
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTableView lost focus detection


  • Subject: Re: NSTableView lost focus detection
  • From: Adam <email@hidden>
  • Date: Thu, 31 Mar 2005 23:59:51 -0500

This will let me know if the cell is highlighted and weather it is focused or not, but will not tell me when the focus changes.


Adam

On Mar 31, 2005, at 8:03 PM, Julian Cain wrote:

Do something like this in your NSCell subclass:

NSColor * hightlightColor = [self highlightColorWithFrame:cellFrame inView:view];
if([self isHighlighted]) {
if([hightlightColor isEqual:[NSColor alternateSelectedControlColor]])
[NSBezierPath drawRect:cellFrame withGradientFrom:_lightBlueColor to:_darkBlueColor];
else
[NSBezierPath drawRect:cellFrame withGradientFrom:_lightGrayColor to:_darkGrayColor];
}


-Julian
On Mar 31, 2005, at 6:55 PM, Adam wrote:

I need to know when my NSTableView has lost and regained focus.

When the user selects a cell I change my text color to white so its more readable against the blue background. However, if they leave the window or select another NSControl somewhere on the window the selection color for the tableview cell turns gray and the white text needs to change to black to be readable, and then to white again if they click back into the tableview. I have tried playing with NSWindowDidBecomeKeyNotification and NSWindowDidResignKeyNotification which worked when they left the window, but didn't address what would happen if they focused on another element in the same window. I also can't get NSViewFocusDidChangeNotification to work how I would like it to.

So basically, how do I know or detect a change of the focused status of an NSTableView / NSTableViews selected cell?

_______________________________________________
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


_______________________________________________ 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
References: 
 >NSTableView lost focus detection (From: Adam <email@hidden>)
 >Re: NSTableView lost focus detection (From: Julian Cain <email@hidden>)

  • Prev by Date: Re: A more attractive NSSlider?
  • Next by Date: Re: Accessing NSArray objects with a key path
  • Previous by thread: Re: NSTableView lost focus detection
  • Next by thread: bindings...
  • Index(es):
    • Date
    • Thread