restore selection from selectedChunk expression

Paul Hibbert paul at livecode.org
Sat Aug 1 17:53:44 CEST 2015


Jacque demonstrated a point, you don’t have to use the whole of gCurrentSelection as part of the script in one go, you can extract the parts you need to reconstruct the selection, it’s pretty easy to adapt the examples she gave;

 select char (word 2 of gCurrentSelection) to (word 4 of gCurrentSelection) of fld (last word of gCurrentSelection)

Paul


> On Aug 1, 2015, at 01:05, Sannyasin Brahmanathaswami <brahma at hindu.org> wrote:
> 
> But I want to re-select the text later,
> not set the background color
> 
> BR
> 
> 
> 
>> On Jul 31, 2015, at 8:05 PM, J. Landman Gay <jacque at hyperactivesw.com> wrote:
>> 
>>> On 7/31/2015 5:52 PM, Brahmanathaswami wrote:
>>> If we make a text selection and store it as a selectedChunk string
>>> 
>>> e.g
>>> 
>>> gCurrentSelection
>>> 
>>> 
>>> which them would have say... a value of
>>> 
>>> char 669 to 1094 of field 6
>>> 
>>> How to I re-select that text?
>>> 
>>> global gCurrentSelection
>>> on mouseUp
>>>   set the backgroundcolor of gCurrentSelection to yellow
>>> end mouseUp
>>> 
>>> works'
>>> 
>>> but
>>> 
>>> global gCurrentSelection
>>> on mouseUp
>>>  selectgCurrentSelection
>>> end mouseUp
>>> 
>>> does not... an i can't find a way to re-set the selection ....
>> 
>> I like to avoid "do" because that requires an on-the-fly compilation, so I generally use this:
>> 
>> set the backgroundcolor of char (word 2 of gCurrentSelection) to (word 4 of gCurrentSelection) of fld "somefield" to "yellow"
>> 
>> Or if the field will vary:
>> 
>> set the backgroundcolor of char (word 2 of gCurrentSelection) to (word 4 of gCurrentSelection) of fld (last word of gCurrentSelection) to "yellow"
>> 
>> --
>> Jacqueline Landman Gay         |     jacque at hyperactivesw.com
>> HyperActive Software           |     http://www.hyperactivesw.com
>> 
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode



Regards,

Paul Hibbert
paul at livecode.org






More information about the use-livecode mailing list