Button state behavior broken by overriding drawInteriorWithFrame
Button state behavior broken by overriding drawInteriorWithFrame
- Subject: Button state behavior broken by overriding drawInteriorWithFrame
- From: Darrin Filer <email@hidden>
- Date: Mon, 11 Feb 2002 17:39:27 -0500
I recently subclassed NSCell and overroad drawInteriorWithFrame
- (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView
*)controlView
Strange thing is, this broke the button. It now behaves more like a Push
On / Push Off button! The state isn't On until after releasing and it
remains on until clicking and releasing the button again. Simply
commenting out my version of drawInteriorWithFrame fixes the problem.
I'm only drawing into the controlView so what gives?
I tried to work around this by overriding the following 3 NSCell methods:
- startTrackingAt:inView:
- continueTracking:at:inView:
- stopTracking:at:inView:mouseIsUp:
Unfortunately, the second two of these are never called even though the
docs say that
- trackMouse:inRect:ofView:untilMouseUp:
should call the continueTracking and stopTracking methods.
Another quick question related to working around this problem:
When a momentary push in button is initially clicked, does its state
change immediately or only after it is determined if the subsuquent
mouseUp is located within the button? In other words, in my
drawInteriorWithFrame routine, do I only need to look at the button's
state or do I also need to know if the button is in the midst of being
pressed? I'm hoping that the former is true so that after the problem
detailed above is fixed, I won't need to add any custom tracking in
order to properly draw the button.
darrin filer
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.