Hi for the second time!
I'm facing an apparently simple problem: I have a function that takes quite long to execute, and I'd like to show a sandglass at the start of the function, to not give impression that the program is frozen. The problem is, the sandglass is shown only at the end of the function, when it's time to delete it. Probably the Gideros engine is not processing GUI events while it's calling an user function. We would need a function like application:processEvents(), something that processes all the events before returning. Is there a way to do that?
Thank you very much
Michele
Comments
http://docs.giderosmobile.com/reference/lua/coroutine#coroutine
Coroutines, you say? I hoped to not have to deal with such a beast, but I'll look at them.
But I know they are not real threads, are you sure they guarantee you that gideros will process other events? And doesn't it require to split your function like with a timer?
Bye
I'm not sure at all of how to put it together, here a synchronous approach, like a function to process all the pending events, would be best. When I first tried it I thought that every programmer in the world would have the need of showing an hourglass before a long operation :-)
Thanks
Michele
If you call showHourGlass(), followed immediately by coroutine.resume(), isn't it the case that the control will not return to gideros anyway between the two, leaving us with the same problem? The example here works well because only prints are called.
Bye
Michele
Does anybody know if setting delay=0 will work as expected?
Bye
Michele
If you don't mind me asking, what are you doing in the function that is taking a long time?
About my project, this is my first experience in mobile/gideros/lua, even if I've been programming for a life for fun and work, and I'm trying to port an old free game that I liked several years ago, but it's much harder than I thought; besides the porting, the original game itself is very complicated, written in java with thousands of classes, many external libraries, used xml, javascript and everything came to the author's mind :-). I don't know if I'll succeed, but I'm progressing costantly in the last months in the few spare time, I'll let you know! (Sorry if I don't say what game it is yet, but I announced this porting many times to its author, I'll feel shame if I cannot finish it :-) )
Bye
Michele