How to find link under cursor in field

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Sjatplat
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 75
Joined: Wed Jun 22, 2011 1:53 pm

How to find link under cursor in field

Post by Sjatplat » Mon Mar 03, 2014 7:05 pm

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

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10333
Joined: Wed May 06, 2009 2:28 pm

Re: How to find link under cursor in field

Post by dunbarx » Mon Mar 03, 2014 8:43 pm

Hi.

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

Craig Newman

Sjatplat
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 75
Joined: Wed Jun 22, 2011 1:53 pm

Re: How to find link under cursor in field

Post by Sjatplat » Mon Mar 03, 2014 8:47 pm

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

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10333
Joined: Wed May 06, 2009 2:28 pm

Re: How to find link under cursor in field

Post by dunbarx » Mon Mar 03, 2014 9:49 pm

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

Sjatplat
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 75
Joined: Wed Jun 22, 2011 1:53 pm

Re: How to find link under cursor in field

Post by Sjatplat » Mon Mar 03, 2014 10:45 pm

Oh Yes!

That works absolutely fine.


Thanks a lot!

Sjat

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: How to find link under cursor in field

Post by jmburnod » Mon Mar 03, 2014 11:39 pm

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
Attachments
GetTextAroundInsertionPoint.zip
(1.55 KiB) Downloaded 213 times
https://alternatic.ch

Post Reply