Re: Composite NSCell subclass event handling
Re: Composite NSCell subclass event handling
- Subject: Re: Composite NSCell subclass event handling
- From: daniel <email@hidden>
- Date: Wed, 16 Mar 2005 00:44:37 -0800
This isn't a very authoritative response, but I have seen the same behavior when implementing composite cells. In my case, I have not used startTracking, but simply overridden trackMouse:... I just set the state of the control myself before and after tracking:
[targetCell highlight:YES withFrame:cellFrame inView:controlView];
trackResult = [targetCell trackMouse:theEvent inRect:cellFrame ofView:controlView untilMouseUp:flag];
[targetCell highlight:NO withFrame:cellFrame inView:controlView];
Maybe if somebody thinks this is a bad idea they can chime in with a better way of doing things...
Daniel
On Mar 13, 2005, at 4:03 PM, Greg wrote:
Hi,
I have a subclass of NSCell that contains a composition of other NSCells, eg NSImageCell, NSPopUpButtonCell, NSTextFieldCell and NSButtonCell. In my "controller cell" I have implemented
- (BOOL)startTrackingAt:(NSPoint)startPoint inView:(NSView *)controlView;
In this method I see if the point is in the rect of each control and if it is, for example in the NSButtonCell's rect, I call the same startTrackingAt: on the button cell. The problem I seem to be experiencing is that it is that the button cell does not seem to showing the depressed state.
- (BOOL)startTrackingAt:(NSPoint)startPoint inView:(NSView *)controlView
{
if (NSPointInRect(startPoint, _addRect))
{
NSLog(@"starting Point: %@ Rect: %@", NSStringFromPoint(startPoint), NSStringFromRect(_addRect));
return [_add startTrackingAt:startPoint inView:controlView];
}
return NO;
}
Does anyone know why this would be the case? Is there any example code that shows the use of implementing a composite type cell?
Regards,
Greg
_______________________________________________
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