Read up on NSView's addCursorRect:cursor: method.

_murat

On Feb 19, 2010, at 1:36 PM, Mazen M. Abdel-Rahman wrote:

Thanks everyone for your help on this. I wanted to know if the mouse was on the border area prior to the mouse down event to determine if the mouse icon should change as the mouse hovers over the border. Is there a way to do this without a mouseMoved event?

Thanks,
Mazen Abdel-Rahman


------------------------------

Message: 11
Date: Thu, 18 Feb 2010 21:44:27 -0700
From: "Mazen M. Abdel-Rahman" <mazen.m.abdelrah...@me.com>
Subject: How to detect if mouse on border of view
To: cocoa-dev@lists.apple.com
Message-ID: <af901566-3187-4949-be67-6e3a70377...@me.com>
Content-Type: text/plain; charset=us-ascii

Hi All,

I was wondering if there is a straight forward away to know if the mouse is on the border of a view? I know how to detect if the mouse enters a view area by using NSTrackingArea - but how can I tell if the mouse is on a border? I would like to replicate iCal's behavior where a user can modify an event on the calendar by clicking on the edge of the appt. rectangle and dragging it.

Thanks,
Mazen


------------------------------

Message: 12
Date: Fri, 19 Feb 2010 15:53:43 +1100
From: Graham Cox <graham....@bigpond.com>
Subject: Re: How to detect if mouse on border of view
To: "Mazen M. Abdel-Rahman" <mazen.m.abdelrah...@me.com>
Cc: cocoa-dev@lists.apple.com
Message-ID: <7c4ab8b0-df1c-4d77-865f-fefda7d5e...@bigpond.com>
Content-Type: text/plain; charset=us-ascii


On 19/02/2010, at 3:44 PM, Mazen M. Abdel-Rahman wrote:

I was wondering if there is a straight forward away to know if the mouse is on the border of a view? I know how to detect if the mouse enters a view area by using NSTrackingArea - but how can I tell if the mouse is on a border? I would like to replicate iCal's behavior where a user can modify an event on the calendar by clicking on the edge of the appt. rectangle and dragging it.


The "border" of a view doesn't really exist - it's infinitely narrow.

What you really want is to detect that the mouse is inside the view but within a pixel or two of the edge. That is easy to work out by comparing the mouse point against the bounds to whatever degree of precision you want (I'd suggest not making it too precise, as it will be hard to hit - 4 pixels minimum is probably OK).

--Graham




------------------------------

Message: 13
Date: Thu, 18 Feb 2010 20:55:08 -0800
From: Jens Alfke <j...@mooseyard.com>
Subject: Re: How to detect if mouse on border of view
To: "Mazen M. Abdel-Rahman" <mazen.m.abdelrah...@me.com>
Cc: cocoa-dev@lists.apple.com
Message-ID: <64436a96-d241-409f-97cf-545ee9c52...@mooseyard.com>
Content-Type: text/plain; charset=windows-1252


On Feb 18, 2010, at 8:44 PM, Mazen M. Abdel-Rahman wrote:

I was wondering if there is a straight forward away to know if the mouse is on the border of a view? I know how to detect if the mouse enters a view area by using NSTrackingArea - but how can I tell if the mouse is on a border? I would like to replicate iCal's behavior where a user can modify an event on the calendar by clicking on the edge of the appt. rectangle and dragging it.

In your mouseDown: method, compare the coordinates against the edges of the view's bounds.
Or is there a reason you need to know before the mouse-down occurs?

˜Jens

------------------------------


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/murat%40pixar.com

This email sent to mu...@pixar.com

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to