Re: Round NSButtonCell
Re: Round NSButtonCell
- Subject: Re: Round NSButtonCell
- From: Brian Webster <email@hidden>
- Date: Sat, 13 Jul 2002 09:55:24 -0500
On Saturday, July 13, 2002, at 07:57 AM, cocoa-dev-
email@hidden wrote:
I would like to know the correct parameters to pass to the
button cell so
that when it "clicks" it displays correctly.
I think this method might be what you're looking for.
- (BOOL)trackMouse:(NSEvent *)theEvent inRect:(NSRect)cellFrame
ofView:(NSView *)controlView untilMouseUp:(BOOL)untilMouseUp;
If you call this on the NSButtonCell, passing in its frame and
the mouse down event that you received, then it should go into a
loop tracking the mouse, highlighting as necessary and sending
its action if the mouse is released within the frame.
Actually, to handle the mouse event, you could override
startTrackingAt:inView: in your cell subclass, and when your
view gets a mouse event, call the trackMouse:... method on your
cell, which will in turn invoke startTrackingAt:inView. You can
then test whether the click is in the button portion of your
cell or the text portion, and either call trackMouse:.. on the
button cell or call [super startTrackingAt:inView:] with the
modified cell frame for the text portion of your cell. This way
you'll get the correct tracking behavior for both portions of
your cell. I've never tested this myself, but it should work in
theory.
--
Brian Webster
email@hidden
http://homepage.mac.com/bwebster
_______________________________________________
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.