Re: Round Buttons Accept Mouse Presses Outside Visible Area
Re: Round Buttons Accept Mouse Presses Outside Visible Area
- Subject: Re: Round Buttons Accept Mouse Presses Outside Visible Area
- From: Ricky Sharp <email@hidden>
- Date: Tue, 22 Mar 2005 12:58:14 -0600
On Tuesday, March 22, 2005, at 12:08PM, Henry McGilton <email@hidden> wrote:
>I noticed this odd behaviour of round NSButtons ---- that is,
>an NSButton with NSCircularBezelStyle set so that the button's
>appearance is circular.
>
>The rect of the button is, obviously, a rectangular area that
>encloses the visible round shape.
>
>However, I notice that you can click the mouse outside of the
>visible round area, and still get a mouse even if the mouse is
>within the rect of the button.
>
>I am not sure if this could be considered a 'bug' or a
>'feature', but I find the behaviour a little annoying.
I guess it can be considered an optimization.
I also feel that there may be a number of folks that would welcome the change in being more exact on what can be clicked on, there's probably an equal number that would be annoyed by it. I consider the areas outside the button's "body" as being "slop" areas. Users may not always have the dexterity to click on the actual body.
In the Carbon flavor of my app, each widget maintained a tracking region that was not limited to rectangles. But in the Cocoa flavor, I decided to scrap this and just let my widgets track based on their bounding rectangle. So over time, I went through both implementations myself.
>I am thinking maybe to create a sub-class that decides if
>the mouse down event is within the visible circular area.
You could do this by overriding hitTest: and return nil if the point is not actually within the "body" of the button.
--
Rick Sharp
Instant Interactive(tm)
_______________________________________________
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