I am sure you actually know this, but the clickChunk does indeed know what the "clickWord" is:
Code: Select all
answer char word 2 of the clickChunk to word 4 of the clickChunk of meModerators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Code: Select all
answer char word 2 of the clickChunk to word 4 of the clickChunk of meCode: Select all
on mouseup
   put word 2 of the clickchunk into tStart
   put 0 into tNbItems
   repeat with i = tStart down to 1
      if char i of fld 1 = "," then add 1 to tNbItems
   end repeat
   put tNbItems+1
end mouseup
Yes, I do, but it doesn't do a blind bit of good in the OP's case.I am sure you actually know this

The handler I posted finds the clicked item in a list field.richmond62 wrote: ↑Sat Dec 26, 2020 10:40 pmYes, I do, but it doesn't do a blind bit of good in the OP's case.I am sure you actually know this
If I click on a word in a sentence in the line of a listField ALL I can get back is the line clicked.
So, knowing that is in this case as valuable as knowing that the moon is not made of cheese.

Code: Select all
on mouseDown
   put empty into fld "fREZ"
   put ((the clickLine) & " : ") into fld "fREZ"
   put the clickText after fld "fREZ"
end mouseDownCode: Select all
on mouseup
   put word 2 of the clickchunk into tStart
   put word 2 of the clickline into tNoLi
   if tStart = empty then exit mouseup
   put 0 into tNbItems
   repeat with i = tStart down to 1
      if char i of fld 1 = cr then exit repeat
      if char i of fld 1 = "," then add 1 to tNbItems
   end repeat
   add 1 to tNbItems
   put "You clicked item" && tNbItems & "=" & item tNbItems of line tNoLi of fld "fText" into fld "fDev"
end mouseup
Code: Select all
on mouseUp
   put the clickCharChunk into tTemp
   if tTemp is empty then
      put "nothing clicked"
      beep
      exit mouseUp
   end if
   put word 2 of tTemp into tTemp
   put the number of lines of char 1 to tTemp of me into tLineNo
   put the number of chars of line 1 to tLineNo -1 of me into tPrevChars
   if tPrevChars > 0 then add 1 to tPrevChars -- add return at end of line
   put the number of items of char 1 to tTemp - tPrevChars of line tLineNo of me into tItemNo
   put "Item " &  tItemNo & " of line " & tLineNo
end mouseUp
Code: Select all
on mouseUp
   put word 2 of the clickCharChunk into x
   put word 2 of the clickline into lineClickedOn
   put char 1 to word 2 of the clickCharChunk of me into tText
   put the number of chars of line 1 to (lineClickedOn - 1) of tText + 1 into upperCount
   answer the number of items of char 1 to  x - upperCount of the last line of tText
end mouseUp