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: Klaus, FourthWorld, heatherlaine, kevinmiller

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

Interchange the line

Post by kevin007 »

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: 14325
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Interchange the line

Post by Klaus »

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 »

@Klaus

many thanks for your help :D
--
Thanks
Kevin
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10507
Joined: Wed May 06, 2009 2:28 pm

Re: Interchange the line

Post by dunbarx »

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: 14325
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Interchange the line

Post by Klaus »

Would I? :shock:
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10507
Joined: Wed May 06, 2009 2:28 pm

Re: Interchange the line

Post by dunbarx »

Klaus.

I was being presumptuous.

Craig.
Klaus
Posts: 14325
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Interchange the line

Post by Klaus »

dunbarx wrote:Klaus.

I was being presumptuous.

Craig.
Thou shalt be forgiven! 8)
Post Reply