delete last card problems

Robert Brenstein rjb at robelko.com
Sun May 22 15:55:47 EDT 2005


>Hi All
>
>I haev a database with a group of fields on it. I have a  delete 
>card button with the script
>on mouseup
>delete card
>end mouseup
>
>This works perfectly with one exception. If I delete all cards down 
>to the last card I still see my database template. If however, I 
>delete the last card I dont see my group of fields.
>
>So I'd like to do something like this
>Have a delete card button that will delete a card unless it is the 
>last one, and if it is the last card only clear the fields
>
>I thought of
>on mouseup
>if this card is not cd 1
>then delete this card
>end if
>if this cd is cd 1
>then clear all fields
>end if
>end mouseup
>
>I get an error with this.....
>
>Any ideas along this line?
>
>cheers
>bob
>

I wanted to say that checking for cd 1 can work only if user deletes 
properly all other cards first. For example, consider a stack with 3 
cards and user is on the last card. He deletes it, so the current 
card becomes 1. Now your check will refuse to delete but clear cards 
instead; however, there is still one more card left.

clear all fields is not a valid construct -- you need to empty one 
field after another.

Robert


More information about the use-livecode mailing list