Clone behaving oddly

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Bill Pittman
Posts: 6
Joined: Sun Jul 23, 2006 9:57 pm

Clone behaving oddly

Post by Bill Pittman » Sun Jan 10, 2010 9:41 pm

Hi,

I'm cloning cards in one of my stacks. The scripts have been working fine, but 2 days ago the behavior of clone changed on me. I made no modifications to the scripts, but when the scripts execute clone now, the only card that gets cloned is the 1st card in the stack. I can manually reorder the cards, and it is always the first card that gets cloned. The only change I made to the stack 2 days ago was to add a data grid to one of the cards. No other changes. I can mark cards, sort cards, manually go to a specific card, and clone still copies the first card only. If I clone using the message window, it works fine. Any thoughts on why this might be happening? I'm using Rev Studio 4/950 Mac.

Thanks.
-Bill

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Clone behaving oddly

Post by Mark » Mon Jan 11, 2010 12:42 pm

Hi Bill,

What is your cloning script?

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Bill Pittman
Posts: 6
Joined: Sun Jul 23, 2006 9:57 pm

Re: Clone behaving oddly

Post by Bill Pittman » Mon Jan 11, 2010 8:08 pm

Hi Mark,

I have tried several variations. Here is one example:

put the short name of this card into tName
if (word 1 of tName is "Task") then
lock screen
sort cards of stack "myStack" numeric by the number of this card
put the number of last card into tNumber
clone this card

This is executed from the card I wish to clone. It clones the first card in the stack. It works in a previous version of the stack.

I also tried marking the cards:

unmark all cards
lock screen
mark cards where word 1 of the short name of this card is "Task"
sort marked cards by the short name of this card
go to last marked card
put word 3 of the short name of this card into tNumber
clone this card

This also results in card 1 being cloned. Both of these scripts find the right card in previous versions of the stack.

Thanks for the assist.
-Bill

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Clone behaving oddly

Post by Mark » Tue Jan 12, 2010 2:50 pm

Hi Bill,

Why do you have to sort the cards first? What happens if you just clone this card and to everything else aftewards? Would it still always close the first card of your stack? What do you get if you add a line "put the id of this cd" in your script, do you get the correct id in the message box?

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Bill Pittman
Posts: 6
Joined: Sun Jul 23, 2006 9:57 pm

Re: Clone behaving oddly

Post by Bill Pittman » Wed Jan 13, 2010 4:36 pm

Hi Mark,

If I clone first, it works. Clone stops working when I moved to another card, and then clone. I can step through the script and see it going to the correct card, but as soon as I call clone, the first card just pops up and that is what gets cloned. I worked around it, but I'm still puzzled why it works in one stack and not in another. Based on the docs, clone should work on whatever card is the current card.

Thanks for the assist.
-Bill

Post Reply