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: Sat, 02 Apr 2016 00:10:05 +1100
On 1 Apr 2016, at 11:44 PM, Phil Stokes <email@hidden> wrote:
>
> but is it reliable?
Given that it's using methods text views themselves rely on, it had better be. (I forgot to mention that you probably need to check it's not out of range.)
>
> What if the mouse position is on the border between two lines or on the border between one glyph and another?
The docs: "If no glyph is under point, the nearest glyph is returned, where nearest is defined according to the requirements of selection by mouse." You can get the exact fraction by using glyphIndexForPoint:inTextContainer:fractionOfDistanceThroughGlyph:, but I'm not sure you can call that via ASObjC because it involves passing a pointer to a CGFloat.
> I don’t know, I’m guessing you’ve done it since you can rattle of the required methods, but it still strikes me as a hell of a lot less code, less points of failure and surely less of a headache to either use an attributed string as Ron suggested or embed an subclass of NSButton as I mentioned.
It a bit of code -- but probably less than making your own attachment cell subclass. And it does directly answer Brian's question.
--
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