Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 2 Jahren, 4 Monaten
Letzter Beitrag:
vor 2 Jahren, 4 Monaten
Beteiligte Autoren:
Bruce Lee, Kingdr, GuenterP, Danny Lauwers

WD20 About image files animation (May be Windev bug)

Startbeitrag von Bruce Lee am 29.01.2016 00: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:

//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
IF fIsImage(sAFile) THEN
fImage = sAFile
c = fImage
AnimationSetParameter(c, "TwoWays", True)
AnimationSetParameter(c, "Duration", nDuration)
[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!



Hi, just a question: why don't you put those images together into a single animated GIF image?

von GuenterP - am 29.01.2016 05:43

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 !

von Danny Lauwers - am 29.01.2016 08:36
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.


von Bruce Lee - am 29.01.2016 18:02
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.


von Bruce Lee - am 29.01.2016 18:05

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.



von Kingdr - am 30.01.2016 14:12
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.