Deleting panding message by name

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
MaxV
Posts: 1580
Joined: Tue May 28, 2013 2:20 pm
Contact:

Deleting panding message by name

Post by MaxV » Tue May 13, 2014 4:02 pm

I didn't find this method explained, but it's very useful. You can delete pending message by name, without recording message id. For example the following code cancel all pending messages named "myMex":

on cancelmessages
repeat for each line templ in the pendingmessages
if item 3 of templ is "myMex" then
put item 1 of templ into temp
cancel temp
end if
end repeat
end cancelmessages
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Deleting panding message by name

Post by jmburnod » Tue May 13, 2014 5:28 pm

Hi Max,

I use this:

Code: Select all

--••stop one pending pMessage
on doStopPending pMessage
   repeat for each line aLine in the pendingmessages
      if pMessage is in item 1 of aLine then
         cancel item 1 of aLine
      end if
   end repeat
end doStopPending

--••stop all pending messages
on stopAllPending 
   repeat for each line aLine in the pendingmessages
      cancel item 1 of aLine
   end repeat
end stopAllPending
Best
Jean-Marc
https://alternatic.ch

Post Reply