Can't delete cards

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
OzSanta
Posts: 34
Joined: Tue Apr 16, 2013 5:48 pm

Can't delete cards

Post by OzSanta » Sun May 05, 2013 4:15 am

G'day

I've got a stack where I'd like to remove groups of cards, but I keep getting the 'can't delete object' message.

The stack level script is called from a button on the cards to be removed, but the Dictionary says only objects containing the handler can't remove themselves.

The script follows, any guidance please?

Regards

Santa

Code: Select all

on scrubJob
   put checkForMultipleJobCards (field "invoice number") into  temp
   put item 1 of temp into theNumberFound
   put item 3 of temp into jobCardList
   Answer warning " "&return&"             WARNING"&return&return&"You are about to delete the "&thenumberfound& " cards of this job." &return&return & "Do you want to proceed?" with "Scrub 'em" or "Don't proceed"
   if it = "Scrub 'em" then
      repeat with x =  number of lines of jobCardList to 1 step -1
         put short id of card (line x of jobCardList) into keepID
         set the cantDelete of card id keepID to false
         go to card id keepID
         delete this card
      end repeat
   end if
end scrubJob

magice
Posts: 457
Joined: Wed Mar 18, 2009 12:57 am

Re: Can't delete cards

Post by magice » Sun May 05, 2013 4:56 am

just for giggles try using the send command to initiate the scrubJob script. So instead of

on MouseUp
scrubJob
end mouseUp

do something like this

on mouseUp
send scrubJob to this stack in 100 milliseconds
end mouseUp

of course that is assuming that the scrubJob script is in the stack script.
Last edited by magice on Sun May 05, 2013 4:58 am, edited 1 time in total.

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Can't delete cards

Post by Simon » Sun May 05, 2013 4:58 am

Hi Santa,
Do you have a preOpenCard or openCard handler on these cards?
You might have to "wait with messages" so they can finish before deleting them.

Other: I hope you made these cards on the fly, as a standalone cannot modify it self. ummm, If a standalone has these cards it can't delete them, on close they'll still be there the next time the standalone is run.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

OzSanta
Posts: 34
Joined: Tue Apr 16, 2013 5:48 pm

Re: Can't delete cards

Post by OzSanta » Sun May 05, 2013 5:27 am

G'day & thanks Magice, that works a treat.

Simon, this stack is not stand alone. I'm designing a Quotation stack for a painter & decorator friend of mine, and the stack needs to be expandable. I thought of using an sql database for the details, but it's a bit beyond me as a beginner. Besides, each card had 360 small fields on it for measurement entry. I wouldn't know where to start!

Regards

Santa

magice
Posts: 457
Joined: Wed Mar 18, 2009 12:57 am

Re: Can't delete cards

Post by magice » Sun May 05, 2013 5:38 am

ozsanta@gmail.com wrote:G'day & thanks Magice, that works a treat.

Santa
You are welcome. Just remember me this Christmas.

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

Re: Can't delete cards

Post by Klaus » Sun May 05, 2013 11:49 am

magice wrote:
ozsanta@gmail.com wrote:G'day & thanks Magice, that works a treat.
Santa
You are welcome. Just remember me this Christmas.
:D :D :D

Post Reply