SelectedChunk

Mike Bonner bonnmike at gmail.com
Mon Sep 27 13:53:49 EDT 2010


Nevermind. *sigh* Number of words prior to selection or insertion point is
      put the number of words of (char 1 to (word 2 of the selectedchunk) of
field 1)

Rev is far more amazing than I can make it be.  So is Livecode!

On Mon, Sep 27, 2010 at 11:50 AM, Mike Bonner <bonnmike at gmail.com> wrote:

> Ok thats cool.
> So if its NOT just an insertion point then
> the number of words of char 1 to (word 2 of the selectedchunk) of field
> "yourfield"
> will give the number of words preceeding the selection?
>
> So this whole thing could boil down to
>
> on mouseUp
>    if word 4 of the selectedchunk < word 2 of the selectedchunk then
>       put the number of words of (char 1 to (word 4 of the selectedchunk)
> of field 1)
>    else
>       put the number of words of (char 1 to (word 2 of the selectedchunk)
> of field 1)
>    end if
> end mouseUp
>
> I knew I was making my solution WAY too difficult. Thanks for this.
>
> On Mon, Sep 27, 2010 at 11:39 AM, Peter Brigham MD <pmbrig at gmail.com>wrote:
>
>> The selectedChunk gives the segment of text selected, in the form
>>
>>  char <chartPosition> to <endPosition> of field <n>
>>
>> If the selection is empty (insertion point only), the result is something
>> like "char 5 to 4 of field 9" -- in this case to get the number of the word
>> containing the insertion point, use:
>>
>>  the number of words of char 1 to (word 4 of the selectedchunk) of field 9
>>
>> If a run of text is selected then the above will get the number of the
>> word containing the end of the selection.
>>
>> -- Peter
>>
>> Peter M. Brigham
>> pmbrig at gmail.com
>> http://home.comcast.net/~pmbrig <http://home.comcast.net/%7Epmbrig>
>>
>>
>>
>>
>> On Sep 27, 2010, at 9:17 AM, Warren Kuhl wrote:
>>
>>  Is there an easy way to retrieve the word # of a field based on the
>>> SelectedChunk?  The SelectedChunk contains the start/end position of a
>>> word
>>> of a field.  Just am trying to determine which word without to much
>>> coding...if possible.
>>>
>>> Thanks for any help!
>>> Warren
>>> _______________________________________________
>>> use-revolution mailing list
>>> use-revolution at lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>>
>>
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>
>
>



More information about the use-livecode mailing list