Page 1 of 1

Deleting all cards from a stack

Posted: Sun Jul 28, 2013 10:53 am
by MaxV
Hi,
I really don't realize how to deleting all cards from a stack, i tried to put on with Stack script:

Code: Select all

delete all cards
but it doesn't work
Then I tried with

Code: Select all

   put the number of cards into temp
   repeat with temp2 = 1 to temp     
      delete card temp2
   end repeat
It starts to delete cards, but it randomly stops with this error: can't find card

How do you delete all cards from a stack?

Re: Deleting all cards from a stack

Posted: Sun Jul 28, 2013 11:00 am
by MaxV
SOLVED, it must be appllied reverse way:

Code: Select all

put the number of cards into temp
   repeat with temp2 = temp down to 1
      delete card temp2
   end repeat
Please note that when the last card is deleted, LiveCode automatically create a new one. It seems that a stack without a card can't exist.

Re: Deleting all cards from a stack

Posted: Sun Jul 28, 2013 11:28 am
by Klaus
MaxV wrote:SOLVED, it must be appllied reverse way:
...
repeat with temp2 = temp down to 1
...
8-)
MaxV wrote:...It seems that a stack without a card can't exist.
Exactly! If there are controls on the "last" card, they will be completely deleted, which is NOT UNDOABLE!


Best

Klaus