|
| WD20 About image files animation (May be Windev bug) |
| Iniciado por guest, 29,ene. 2016 01:13 - 5 respuestas |
| |
| | | |
|
| |
| Publicado el 29,enero 2016 - 01:13 |
Hi everyone,
I am trying to make windev get each image file in a folder and do animation one by one infinitely (until I ask it to pause or stop).
I create a ParallelTask and pass image control as a parameter. Windev just crashed and show me the error info. Also, I think the source code of windev do a trace here.
Here is my code: //End of initialization of WIN_RearVideo: ParallelTaskExecute(AnimateImage,(WIN_RearVideo.IMG_Image))
//Global Procedure PROCEDURE AnimateImage(c is Control) sImageDirectory is string = gsDisplayImagePath + "\*.*" fImage is Image ResFileList is string bFlag is boolean = True nDuration is int = 1000
IF sImageDirectory <> "" THEN ResFileList = fListFile(sImageDirectory, frRecursive + frInterruptible) //while bFlag FOR EACH STRING sAFile OF ResFileList SEPARATED BY CR IF fIsImage(sAFile) THEN fImage = sAFile c = fImage AnimationSetParameter(c, "TwoWays", True) AnimationSetParameter(c, "Duration", nDuration) Wait(nDuration) END END //end END [attachment 1857 error1.jpg] [attachment 1858 error2.jpg]
I don't trace anything like that in my code. Is this a windev bug? If I make this global procedure automated(Timer/Scheduled procedure), windev would tell me that control can not be converted to image.(I guess it is this part "c = fImage") (But if I don't make it automated, it works fine). If I used thread instead of parallel task, WIN_RearVideo would disappear. (Not sure why) How do I get around this thing and get my image work?
Thank you!
Bruce |
| |
| |
| | | |
|
| | |
| |
| Publicado el 29,enero 2016 - 06:43 |
| Hi, just a question: why don't you put those images together into a single animated GIF image? |
| |
| |
| | | |
|
| | |
| |
| Publicado el 29,enero 2016 - 09:36 |
Hi,
If you are doing GUI in the parallel task, this would crash because GUI stuff needs to be done on the main thread of the application.
You can prepare alle things in the parallel task, but touching the IMG_Image must be done on the Mainthread. You can use EXECUTEMAINTHREAD to call a function thats draws the image. Or set a function to run on the mainthread via timer options of the function.
But you could also run a timer/scheduled function on the main thread todo this, there is no heavy lifting or long process calculation in your function, just getting the images and putting them on the screen, thats GUI stuff.
Hope's this help ! Danny |
| |
| |
| | | |
|
| | |
| |
| Publicado el 29,enero 2016 - 19:02 |
Hi Guenter,
Sorry about the confusion. I didn't put those images together into a single GIF. I get each one of them and show it in the image control. Because when windev does animation, it looks like only allows one pic at one time. But I want to do multiple pics.
Thank you.
Bruce |
| |
| |
| | | |
|
| | |
| |
| Publicado el 29,enero 2016 - 19:05 |
Hi Danny,
I tried your method, but it looks like the image control will crash when I use timer. I will manually write a loop to control it. I would use thread in this case.
Thank you.
Bruce |
| |
| |
| | | |
|
| | |
| |
| Publicado el 30,enero 2016 - 15:12 |
Danny
It could be the racing time issue. Why not give it try loading JPGs in memory and timer should do the job or lessen size of each JPG and before loading next JPG to imgControl, do assignment imgMyControl = "" to clear it out.
It could be a memory crash somehow somewhere, then you have to avoid to use your thread.
I would suggest that you do test your existing threads with each JPG as smallest as possible and if it works then you might work around with such.
HTH
King |
| |
| |
| | | |
|
| | | | |
| | |
|