Pending Messages
Phil Davis
revdev at pdslabs.net
Wed Feb 15 03:47:11 EST 2012
Hi Michael,
On 2/14/12 2:09 PM, Michael Doub wrote:
> I am looking for some advise before start trying to figure out how throw away messages .
>
> I am currently catching touch movement events and rendering a graph within a slider. Clearly the rendering is slowing things a bit and I am
> experiencing some sluggishness. I am thinking about trying to look at the pending messages from within the touch move handler and only processing the last move message.
One way to do that:
local sDoitID -- ID of a pending message
on touchMove tID, x, y
cancel sDoitID -- works OK if no ID exists too
send "doit x,y" to me in 1 tick
put the result into sDoitID
end touchMove
This way there is only one pending message at any time - and it's the last one
sent. Maybe that will improve responsiveness.
Best -
Phil Davis
> Initially I was thinking of replacing the doit command below with a send after 0 ticks command but it seems to me this would only work if the TouchMove message is a higher priority than the doit message. For that matter checking in the touch move handler assumes that the engine is adding touch messages to the pending message list at a higher priority that the TouchMove handler itself.
>
> I don't think there is any notion of priority in the message path, so I am not sure if I am thinking about this problem correctly. Can anyone provide me with a bit of advice on this topic.
>
> Thanks
> Mike
>
>
>
>
> today:
>
> On TouchMove tID, x, y
> doit x, y
> end TouchMove
>
> On doit
> -- render here
> End doit
>
>
> Option 1:
>
> On TouchMove tID,x,y
> look at pending messages
> capture the x y of the last message
> cancel all of the touch move messages
> doit x,y
> End TouchMove
>
>
> Option 2:
>
> On TouchMove tID, x, y
> send ("doit"&& x& comma& y) to me in 0 ticks
> end TouchMove
>
> On doit
> look at pending messages
> capture the x y of the last doit message
> cancel all of the doit messages
> -- render here using last x y
> End doit
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
--
Phil Davis
PDS Labs
Professional Software Development
http://pdslabs.net
More information about the use-livecode
mailing list