How to enter chars at the place one clicked on? [SOLVED]
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
How to enter chars at the place one clicked on? [SOLVED]
I want to enter "(·)" into a word in a label at the position where a user clicked: "example" should become "examp(·)le" afterwards (it's for an educational training on hyphenation).
I found the function clickChar. It returns the character the user has clicked on, which is fine. But how can I insert "(·)" after this character? I need to get the position of the clicked char in the field, somehow - but how? Other solutions?
I found the function clickChar. It returns the character the user has clicked on, which is fine. But how can I insert "(·)" after this character? I need to get the position of the clicked char in the field, somehow - but how? Other solutions?
Last edited by gtheus on Sat Jan 29, 2022 9:46 pm, edited 2 times in total.
Re: How to enter chars at the place one clicked on?
Hi,
It seems clickcharchunk function does the job
Best regards
Jean-Marc
It seems clickcharchunk function does the job
Code: Select all
on mouseup
put "(.)" into the clickcharchunk
end mouseup
Jean-Marc
https://alternatic.ch
Re: How to enter chars at the place one clicked on?
That's it! Much easier than I feared...
I modified your solution to…
…to get the desired solution.
Thank you for this quick help!

I modified your solution to…
Code: Select all
put "(.)" after the clickcharchunk
Thank you for this quick help!
-
- Livecode Opensource Backer
- Posts: 10078
- Joined: Fri Feb 19, 2010 10:17 am
Re: How to enter chars at the place one clicked on?
- Attachments
-
- INSERT.livecode.zip
- Here's the stack.
- (1.36 KiB) Downloaded 170 times
Re: How to enter chars at the place one clicked on?
Thank you both for your help!
Re: How to enter chars at the place one clicked on? [SOLVED]
Hi Richmond,
I tested your script but it doesn't work
I get an error, "chunk: no target found" because the selectedchunk is empty
Kind regards
Jean-Marc
I tested your script but it doesn't work
I get an error, "chunk: no target found" because the selectedchunk is empty
Kind regards
Jean-Marc
https://alternatic.ch
-
- Livecode Opensource Backer
- Posts: 10078
- Joined: Fri Feb 19, 2010 10:17 am
Re: How to enter chars at the place one clicked on? [SOLVED]
Working perfectly in the Balkans.

LC 9.6.3 / MacOS 12.3 RC1
Re: How to enter chars at the place one clicked on? [SOLVED]
Sorry Richmond,
it works with traversalon = true
(not needed with clickcharchunk)
Best
Jean-Marc
it works with traversalon = true

(not needed with clickcharchunk)
Best
Jean-Marc
https://alternatic.ch
-
- Livecode Opensource Backer
- Posts: 10078
- Joined: Fri Feb 19, 2010 10:17 am
Re: How to enter chars at the place one clicked on? [SOLVED]
Quite possibly, but over here my stack works exactly as I programmed it.Sorry Richmond,
it works with traversalon = true
(not needed with clickcharchunk)