Library to Cancel PendingMessages

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Library to Cancel PendingMessages

Richard Gaskin via use-livecode
We anticipate using more and more animation in our app. It is like
Levure in the sense that it is has a lot of "view" module/stacks.

For now I just need to cancel one or two. Which we can very easily do
"locally"  -- store the result and cancel on close card.

But I wonder about a global library. Where the messages contained in
"pScope"  (all the animation on a given card)

# user will immediately close a card that has animation on progress.

I wonder before I go start reinventing the wheel there, if someone how a
global library for canceling the pending message. The idea is

send "gotoPathIndex" to me in 4 seconds
send "moveTiger" to me in 3 seconds

I started in this but got lost in how to manage 2 dimensional arrays
with with  "wild card" in the second dimension.  So I just got it
working for one card, for one animation for now


# card script:

on preOpenCard  
   send "gotoPathIndex" to me in 4 seconds
   put the result into pResult
   --   put the pendingmessages
   --   breakpoint
   queueStackMessages "CoverAnimation","closeCardTransition",pResult
end preOpenCard

on closeCard
   cancelStackMessages "CoverAnimation", "closeCardTransition"
end closeCard

# stack script: testing, will put in a back script eventually

# queueStackMessages
# Param1: e.g all pending message for a given card animation(s)
# Param2: e.g the name of the message
# Param3: e.g the result--Message ID

local sStackPendingMessagesA

command queueStackMessages pScope,pName,pResult
   put pResult into sStackPendingMessagesA[pScope][pName]
end queueStackMessages

# -- cancelMessages

command cancelStackMessages pScope,pDescription,pResult
   cancel sStackPendingMessagesA["CoverAnimation"]["closeCardTransition"]
   --   if param(2) is empty and param(3) is empty then
   --      repeat for each key K in sStackPendingMessagesA
   --      end if
  -- # oops - got lost in
  -- # how cancel all animation in pScope

end cancelStackMessages

two more questions:

1) how to get a "wild card" in an array, or do we need a repeat loop to
thru the keys

cancel sStackPendingMessagesA["CoverAnimation"][*wildCard*]

2) can you cancel a message with its name? I suspect not. We will have
parse the pendingMessages.

3) You always have a global license to say "This is bad architecture.
Why don't you do it like this?"

53428,1539662235.139143,gotoPathIndex,card id 1088 of stack


use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences: