Re: Is it possible to get mouse click position in Scroll View?
Re: Is it possible to get mouse click position in Scroll View?
- Subject: Re: Is it possible to get mouse click position in Scroll View?
- From: Shane Stanley <email@hidden>
- Date: Fri, 01 Apr 2016 22:17:18 +1100
On 1 Apr 2016, at 9:50 PM, phil stokes <email@hidden> wrote:
>
> I’d be surprised if you could ever reliably associate the mouse position with the text underneath it
If it's a text view, you can. You need to subclass the text view and override mouseDown:. You get the passed event's loctionInWindow, use convertPoint:FromView: to get the location in the text view, then tell the view's layout manager to return glyphIndexForPoint:inTextContainer:. You then call characterIndexForGlyphAtIndex: to convert from a glyph index to a char index, and from there you can work out the line number. Not simple, but not brain surgery either.
--
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
applescriptobjc-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden