On Sun Jun 22, 2008, James Hurley jhurley0305 at sbcglobal.net wrote:

For reasons I won't go into, I need a function like: ClickWord which will return something like:

Word 2 of line 3 of field 4

It would be something like "ClickLine" only it returns the word number as well. ClickChunk is close but no cigar.

Seems like this would be a natural for RunRev, but I have forgotten how to make the enhancement request.

Anybody? Where is the RunRev web site?

Jim Hurley

P.S.

My kludge of this looks like:

function theClickWord
-- this function returns: word tWordNo of line tLineNo of field tFieldNo
   put the clickLine into tClickLine
   put word 2 of tClickline into tLineNo
   put last word of tClickLine into tFieldNo
   put the value of tClickLine into tLineText
   put the clickText into tWord
   put wordoffset(tWord,tLineText) into tWordNo
   --Just to see how it might look if implemented in RunRev
put "word " & tWordNo & " of line " & tLineNo & " of field "& tFieldNo into msg box
   return tWordNo, tLineNo, tFieldNo
end theClickWord


The website for reporting bugs and enhancements is

<http://www.runrev.com/support/quality-control-center/> or
<http://quality.runrev.com/qacenter/>

I second you enhancement request.

Your "kludge"-solution is surely one of the best you can come up with in Revolution. The only problem you could encounter is the case when the text of the line contains more than one instance of the word, because wordoffset always finds the *first* instance of the word and not necessarily the word you clicked at.

In a related context - getting the wordnumber of a clicked-at word in a field and at the same time hilite the clicked word - I have found the following solution:

Script of the text field:

on mouseUp
 Global gchunk, gtext
 put the mousechunk into gchunk
 put the mousetext into gtext
 send "mouseup" to btn "wordoffset"
end mouseUp

Script of btn "wordoffset":

on mouseUp
 Global gchunk, gtext
 put fld 1 into tField
 put tfield into tfield2
 put word 2 of gchunk into tBegin
 put "#" before char tBegin of Tfield2
 put "#" before gtext
 put wordoffset(gtext,tfield2) into tword
 put "word" &&tword&&"in field 1" into fld "wordnumber"
 set the traversalon of fld 1 to true
 select word tword of fld 1
end mouseUp

_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to