Page 1 of 1

How to find link under cursor in field

Posted: Mon Mar 03, 2014 7:05 pm
by Sjatplat
Hi there

I have a editable field where the user can input links at the cursor position.
I want to control the field so that a link will be hilited when the cursor enters it.

Something like the mousechunk - but using the cursor position.

Is there a solution to this?

Sjat

Re: How to find link under cursor in field

Posted: Mon Mar 03, 2014 8:43 pm
by dunbarx
Hi.

Read up on the "mouseText" function in the dictionary. It also handles grouped text.

Craig Newman

Re: How to find link under cursor in field

Posted: Mon Mar 03, 2014 8:47 pm
by Sjatplat
Thank you,

but I know about mouseText and mouseChunk - what I'm after is something that can give me the word or hyperlink where the text insertion point is (text cursor).

Sjat

Re: How to find link under cursor in field

Posted: Mon Mar 03, 2014 9:49 pm
by dunbarx
I am old.

I suspect some of the whippersnappers around here will come up with the right answer to this question. Anyway, this horrible kluge might be what you need. If you have some text in a field, some of which is grouped and some not, set the cursor wherever you like. Now click in a button that has this in its script:

Code: Select all

on mouseup
   click at the selectedLoc
   answer the clickText
end mouseup
Ugh. But works.

Craig Newman

Re: How to find link under cursor in field

Posted: Mon Mar 03, 2014 10:45 pm
by Sjatplat
Oh Yes!

That works absolutely fine.


Thanks a lot!

Sjat

Re: How to find link under cursor in field

Posted: Mon Mar 03, 2014 11:39 pm
by jmburnod
Hi,
Here is a stack with an other way to do that.
It return the text around the insertion point and if it is a link or not

Best regards
Jean-Marc