• 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: OutlineView with custom TableColumn cell doesn't redisplay when losing focus
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: OutlineView with custom TableColumn cell doesn't redisplay when losing focus


  • Subject: Re: OutlineView with custom TableColumn cell doesn't redisplay when losing focus
  • From: Corbin Dunn <email@hidden>
  • Date: Fri, 27 Feb 2009 10:24:52 -0800


On Feb 27, 2009, at 9:18 AM, Jerry Krinock wrote:


On 2009 Feb 26, at 23:39, Stuart Malin wrote:

BOOL isViewInFocus = [[[[self controlView] window] firstResponder] isEqual:[self controlView]];

Is there perhaps a better way to determine if a view is "key" ?

No, but I believe you should also check that the control view's window -isKeyWindow or -isMainWindow.

If you are implementing code in an NSCell, then you shouldn't have to do this. Instead look at the cell's backgroundStyle; if it is NSBackgroundStyleDark, then you are being drawn in a selected row that is focused. If it is NSBackgroundStyleLight, then you are being drawn in a non-selected row, or a selected row that isn't in a firstResponder tableview.


For views, they will have to check to see if self.window.firstResponder == self. == is okay, since views aren't copyable. You may also have to check of self.currentEditor == self.window.firstResponder, if you support editing and use the field editor.



On 2009 Feb 26, at 23:58, Kyle Sluder wrote:

Well "focus" does have a meaning (see -[NSView lockFocus]), but I
figured you didn't mean that here.

Yes, about a week ago I concluded that, unfortunately, Cocoa uses the word "focus" in two different contexts: "keyboard focus" and "drawing focus". Someone please correct me if I'm wrong.



You are right -- we frequently toss around both terms. The term "firstResponder" is for the view that has the first chance of input by the user; this is the thing that has keyboard focus, and those views usually draw the focus with NSSetFocusRingStyle(..).


lockFocus is for drawing into a view/image.

corbin


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >OutlineView with custom TableColumn cell doesn't redisplay when losing focus (From: Stuart Malin <email@hidden>)
 >Re: OutlineView with custom TableColumn cell doesn't redisplay when losing focus (From: Kyle Sluder <email@hidden>)
 >Re: OutlineView with custom TableColumn cell doesn't redisplay when losing focus (From: Stuart Malin <email@hidden>)
 >Re: OutlineView with custom TableColumn cell doesn't redisplay when losing focus (From: Jerry Krinock <email@hidden>)

  • Prev by Date: Re: Why doesn't this work on my device?
  • Next by Date: Re: Why doesn't this work on my device?
  • Previous by thread: Re: OutlineView with custom TableColumn cell doesn't redisplay when losing focus
  • Next by thread: Re: NSComboBox Bindings
  • Index(es):
    • Date
    • Thread