Interchange the line

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
kevin007
Posts: 40
Joined: Mon Sep 21, 2015 7:46 am

Interchange the line

Post by kevin007 » Mon May 23, 2016 6:49 am

Hi All,

How to interchange the line. I have a text field when I give the input like "1-3" then first and third line should interchange.

Thanks
kevin
--
Thanks
Kevin

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Interchange the line

Post by Klaus » Mon May 23, 2016 10:06 am

Hi Kevin,

OK, now you know how to "display second value in a variable ", so you can:
...
## Put lines to interchange into variables:
put line 1 of fld "interchange" into tLine1
put line 3 of fld "intercahnge" into tLine2

## And now simply "swap" the lines in the field:
put tLine2 into line 1 of fld "interchange"
put tLine1 into line 3 of fld "interchange"
...
Is that what you mean?


Best

Klaus

kevin007
Posts: 40
Joined: Mon Sep 21, 2015 7:46 am

Re: Interchange the line

Post by kevin007 » Wed May 25, 2016 10:07 am

@Klaus

many thanks for your help :D
--
Thanks
Kevin

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: Interchange the line

Post by dunbarx » Wed May 25, 2016 12:18 pm

Kevin

Klaus would feel gratified if you would write a handler that does what you asked:

Code: Select all

switchLines line1,line2
Why is this not particularly suited to a function?

Craig Newman.

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Interchange the line

Post by Klaus » Wed May 25, 2016 12:26 pm

Would I? :shock:

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: Interchange the line

Post by dunbarx » Wed May 25, 2016 3:47 pm

Klaus.

I was being presumptuous.

Craig.

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Interchange the line

Post by Klaus » Wed May 25, 2016 4:29 pm

dunbarx wrote:Klaus.

I was being presumptuous.

Craig.
Thou shalt be forgiven! 8)

Post Reply