Re: OutlineView with custom TableColumn cell doesn't redisplay when losing focus
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