Page 1 of 1

How to swap text from 2 text fields

Posted: Fri Nov 23, 2012 12:01 pm
by ivaho
Hi,

I have to text fields containg names.
What i want to do is selecting two names in the different text fields and than swap those names.

Kind regards Ivo

Re: How to swap text from 2 text fields

Posted: Fri Nov 23, 2012 1:01 pm
by jmburnod
Hi Ivaho,
Something like that ?

Code: Select all

on swapLines
   put the hilitedlines of fld 1 into tHi1
   put the hilitedlines of fld 2 into tHi2
   if tHi1 = empty or tHi2 = empty then exit swapLines
   put line tHi1 of fld 1 into tCont1
   put line tHi2 of fld 2 into tCont2
   put tCont1 into line tHi2 of fld 2
   put tCont2 into line tHi1 of fld 1
end swapLines
Kind regards
Jean-marc

Re: How to swap text from 2 text fields

Posted: Fri Nov 23, 2012 6:51 pm
by ivaho
thanks for your help

Re: How to swap text from 2 text fields

Posted: Fri Nov 23, 2012 7:12 pm
by Klaus
Hi Ivo,

hint: Jean-Marcs solution will only work with LIST fields!


Best

Klaus

Re: How to swap text from 2 text fields

Posted: Fri Nov 23, 2012 8:34 pm
by jmburnod
Hi Klaus,
Selecting two chunks in two different fields is possible ? :shock:
Best
Jean-Marc

Re: How to swap text from 2 text fields

Posted: Sat Nov 24, 2012 1:03 pm
by Klaus
Hi Jean-Marc,

yes, I tested this and was also surprised :D

The trick is to uncheck "traversal on" for the fields, but then you cannot write into the fields, so it is in fact useless 8)
However you can put text into these fields by script and THEN you can have a selection in each field by doucleclicking words.

So this is of doubtful use...


Best

Klaus