[FIXED] Re: Focus ring not displaying while editing custom split NSCell
[FIXED] Re: Focus ring not displaying while editing custom split NSCell
- Subject: [FIXED] Re: Focus ring not displaying while editing custom split NSCell
- From: "Brad Willoughby" <email@hidden>
- Date: Tue, 15 May 2007 09:39:05 -0700
Thanks to I.S., Steve, and Kevin for responding on list and bwebster
for replying on #macsb, I managed to make this work.
Getting the text to not over-type on the existing text was simply a
matter of implementing the following in my NSCell subclass:
- (void)setDrawsBackground:(BOOL)flag {
[[self timeTextFieldCell] setDrawsBackground:flag];
[[self nameTextFieldCell] setDrawsBackground:flag];
}
After that, getting the focus ring to draw properly was accomplished
within drawWithFrame by determining which subcell was being edited and
then doing:
[NSGraphicsContext saveGraphicsState];
NSSetFocusRingStyle(NSFocusRingOnly);
[[NSBezierPath bezierPathWithRect:focusRingFrame] fill];
[NSGraphicsContext restoreGraphicsState];
Also, for the record, it was suggested off-list that I move to using
to individual NSTextFieldCells in two columns instead of cramming two
subcells into one column. This avoids these drawing problems as well
as keyboard navigation/focus problems. I'll look into modifying our
UI to make this happen.
Thanks for the help.
Cheers,
Brad
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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