Re: drawing custom button in cocoa
Re: drawing custom button in cocoa
- Subject: Re: drawing custom button in cocoa
- From: Mike Ferris <email@hidden>
- Date: Thu, 2 Jan 2003 08:32:50 -0800
If you want to limit the active area of your button the best way is
probably to override -hitTest:.
You should figure out if the point is in your active area (inside the
button shape) and return self if it is and return [super hitTest:event]
if it is not.
To do the test, you can do whatever is easiest. One way would be to
create an NSBezierPath for the outline of the active area and use it to
hit test.
Mike
Begin forwarded message:
From: "orochi_huang" <email@hidden>
Date: Thu Jan 2, 2003 2:22:49 AM US/Pacific
To: <email@hidden>
Subject: drawing custom button in cocoa
I want to draw a custom shape button in my cocoa program,so I created
a custom view in Interface Builder and subclassed NSButton to recevie
mouse click action,I overwrited the drawRect: function to make myself
shape.the shape shows correct,but when I click region outside the
shape but in the rect of button,button click actions as if the mouse
is in the shape region,I noticed it is because I filled the rect
only,but not the region.But I didn't found anything in Cocoa can
create a region from paths and rects,so how I can create custom button
in cocoa?
_______________________________________________
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.
_______________________________________________
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.