Page 1 of 1

Can't delete cards

Posted: Sun May 05, 2013 4:15 am
by OzSanta
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

Re: Can't delete cards

Posted: Sun May 05, 2013 4:56 am
by magice
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.

Re: Can't delete cards

Posted: Sun May 05, 2013 4:58 am
by Simon
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

Re: Can't delete cards

Posted: Sun May 05, 2013 5:27 am
by OzSanta
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

Re: Can't delete cards

Posted: Sun May 05, 2013 5:38 am
by magice
ozsanta@gmail.com wrote:G'day & thanks Magice, that works a treat.

Santa
You are welcome. Just remember me this Christmas.

Re: Can't delete cards

Posted: Sun May 05, 2013 11:49 am
by Klaus
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