Question to scripters:
Question to scripters:
I want to set the position of a desktop with animation (‘true’) and then I want to do some other things.
The problem is that setPosition(x,y,s,true) is processed separately, I mean, the rest of the script is immediately run after, while the desktop is scrolling.
What I’m doing now is to launch the rest of the code with a timeout after some millisecond, but I was looking for a ‘more exact’ way.
Do you know any? Do you think the API will need to have a dedicated function?
]]>
< ![CDATA[
Maybe a setPosition with a callback.
]]>
< ![CDATA[
Uhm, don’t know that feature (of JavaScript? )
Could you explain it? Thanks! Edit: ok, I searched what a callback is and I saw it was a suggestion for the setposition API function.
]]>
< ![CDATA[
It would be very helpful to know when the scrolling is finished
]]>
< ![CDATA[
I would generalize this feature request: I also want after item.setPostion/Cell know when the item is actually moved, what is also not instant. I think there are some other things done asynchronous. For all these it would be great to know when they finished
]]>
< ![CDATA[
Pierre Hébert: what do you think? Do you have any suggestion?
]]>
< ![CDATA[
Yes a callback would be the right way to be notified of completion.
There are two kind of asynchronous execution though: some of them takes time (scrolling animation), some don’t and are just delayed (not run immediately but will be completed right after).
For the first type a callback is needed, for the second there is a workaround: setting a timeout with a 0 duration should be enough. In theory set cell and position changed should fall in the second category. not tested though)
]]>
< ![CDATA[
Thanks. Workaround works 😉
]]>