clickText and other clicks

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
robinul
Posts: 6
Joined: Sun Apr 17, 2022 3:16 pm

clickText and other clicks

Post by robinul » Mon May 09, 2022 4:25 pm

I have a field in which a paragraph is displayed. I want to be able to get the clickText when a particular word is clicked. Clicking on a word in the field returns nothing. Neither does clickChunk or clickLine work. I now have the following settings for the field: Visible, Share text. Lock text, Opaque, Focus border, though I have tried a number of other combos of settings for this field without success. I have another field that is a list, and with the List behaviour set, that field works perfectly so LiveCode is receiving some signal that I have clicked the mouse.

The attached image shows the field. The word in bold at the top is a separate field as is the icon in the top right of the box. The field that I am having problems with is the field below that, which displays the definition. The words in blue indicate that the word is in the dictionary. I want the user to be able to click on such words and have the dictionary open to that word with its explanation. That can be done quite simply if I can get the field to return the clickText.
Attachments
Screen Shot 2022-05-09 at 8.59.36 AM.jpg

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: clickText and other clicks

Post by jmburnod » Mon May 09, 2022 4:58 pm

Hi,
Strange.
Clicktext works fine here (OSX 10.14.6, LC 9.6.6)
What version do you use ?
Best regards
Jean-Marc
https://alternatic.ch

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9648
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: clickText and other clicks

Post by dunbarx » Mon May 09, 2022 5:59 pm

I have never had a similar problem. How do you invoke the clickText function?

I assume it is a handler in the field script, and looks something like this:

Code: Select all

on mouseUp
  answer the clickText
end mouseUp
I bet the issue is something along those lines...

Craig

stam
Posts: 2679
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: clickText and other clicks

Post by stam » Tue May 10, 2022 2:38 am

Same result here - as long as the field has it's lockText set to true, clickText returns the clicked word...

robinul
Posts: 6
Joined: Sun Apr 17, 2022 3:16 pm

Re: clickText and other clicks

Post by robinul » Tue May 10, 2022 1:53 pm

Thanks for these suggestions.

Here is the starting script for the mouseUp. Nothing happens. It is the same way I call for click features in another field provides the clicked data requested. As I said in my introduction, I have been away from LiveCode for about 18 years, so a simple solution is likely. Thanks for taking time to help me sort out what should be obvious to me. The lockText of the field is set to true.

on mouseUp
put the clicktext into ct
put the clickline into cl
put the clickchunk into cc

robinul
Posts: 6
Joined: Sun Apr 17, 2022 3:16 pm

Re: clickText and other clicks

Post by robinul » Tue May 10, 2022 1:56 pm

I should point out that I am using version 10 . 0 . 0-dp-3 | Build 20002

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9648
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: clickText and other clicks

Post by dunbarx » Tue May 10, 2022 2:06 pm

Hi.

So you are saying that you have another locked field and all those functions work? Good.

Try making brand new field from scratch and see if that one works for you. I cannot imagine that your original field is "corrupted" in some way, but if this is a path forward, then as I alway say, "I am happy to solve a problem without ever understanding how".

If that does indeed work, it is up to you to find out why. You might compare the results of "the properties" of each field. This will come back as an array, so you will need to "combine" that data with, say, a return and a comma in order to see the output. Likely an academic exercise, but might be instructive.

Craig

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9648
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: clickText and other clicks

Post by dunbarx » Tue May 10, 2022 2:08 pm

I should point out that I am using version 10 . 0 . 0-dp-3 | Build 20002
Well, maybe there is something else going on. Have you tried this in v.9x?

Craig

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: clickText and other clicks

Post by jmburnod » Tue May 10, 2022 2:25 pm

Hi All,
Clicktext works on LC 10 . 0 . 0-dp-1 | Build 20000
https://alternatic.ch

robinul
Posts: 6
Joined: Sun Apr 17, 2022 3:16 pm

Re: clickText and other clicks

Post by robinul » Tue May 10, 2022 3:32 pm

The good news: the clickText function is now working as it should.

The bad news: I am not sure why it is now working. I did not change any of the settings for the field.

I appreciate your help and do wish I could report where the problem was.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9823
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: clickText and other clicks

Post by FourthWorld » Tue May 10, 2022 5:03 pm

#ProgrammerLife
Image
Attachments
my-code-doesnt-work-i-have-no-idea-why-my-code-works.jpg
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

stam
Posts: 2679
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: clickText and other clicks

Post by stam » Tue May 10, 2022 5:56 pm

More than once I’ve had a situation where there’s been a subtle error - by subtle I mean an error that has not raised any exceptions in the IDE and the developer is not notified in any way, but which halts code execution and can cause subsequent incomprehensible errors - code that should work fine doesn’t.

Not so long ago I flagged up such a situation to LC and the bug report was acknowledged and confirmed, but any kind of fix (such as notifying the dev on error) is still pending and I suspect not easy to address. I’m guessing the solution will be the conversion to the new bytecode evaluator.

In the mean time, clues to this being the cause are:
- The error is not reproducible when you extract the code in isolation to a new stack
- the error goes away on quitting and restarting the IDE (assuming the error doesn’t happen every time you run the app).

Do you think it could have been something like that?

Post Reply

Return to “Talking LiveCode”