NSCell drawWithFrame inView:: is off by 1 sometimes in an NSTableView?
NSCell drawWithFrame inView:: is off by 1 sometimes in an NSTableView?
- Subject: NSCell drawWithFrame inView:: is off by 1 sometimes in an NSTableView?
- From: Dave Camp <email@hidden>
- Date: Thu, 27 Jan 2005 15:03:47 -0800
I've got a simple subclass of NSCell I'm putting in an NSTableColumn.
The only method implemented looks like:
- (void)drawInteriorWithFrame:(NSRect)cellFrame
inView:(NSView*)controlView
{
NSLog(@"%@", NSStringFromRect(cellFrame));
}
The problem is that when it's called to draw on mouse down and mouse
up, cellFrame.origin.x is off by one from when I'm called to draw for
other reasons. In working code, the image I'm drawing offsets by one
pixel to the right on mouse down and mouse up, but draws normally in
other cases. Log output looks like:
{{749, 235}, {18, 16}} - Normal draw
{{750, 235}, {18, 16}} - Mouse down. Note that the X is off by one
{{750, 235}, {18, 16}} - Mouse up. Still off by one
{{750, 235}, {18, 16}} - Mouse down
{{750, 235}, {18, 16}} - Mouse up
{{749, 235}, {18, 16}} - Resize window or deselect, or any other
non-mouse draw response
I've also tried implementing drawWithFrame:inView: but it has the same
problem.
I thought this might be some sort of default button offsetting on mouse
down, but if that was the case the Y should change on mouse down and
the offsets should be removed on mouse up. I'm not seeing that.
Anyone know what's going on here?
Thanks,
Dave
---
Among the chief weapons of UNIX: Fear, surprise and ruthless
efficiency.
_______________________________________________
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