Solved

animated bmp slow... should I use threads?

Posted on 2004-08-13
4
185 Views
Last Modified: 2010-04-05
I've got an animated BMP list (its a jedi component) and it runs at the top of an upload page I have.   I'm using indy.  first http then ftp.   I have an antifreeze component in there as well.    When the uploading begins / progresses  the animation will become sticky and start / stop a lot.    This looks silly and I know there must be an answer.   Can you make a suggestion?


Thanks!
0
Comment
Question by:hibbidiji
4 Comments
 
LVL 11

Expert Comment

by:Jase-Coder
ID: 11799179
you could try making your animation in a thread that should solve the problrm. But you could also put your uploading procedure in a thread.
Try them both to see which is the best
0
 
LVL 17

Accepted Solution

by:
geobul earned 500 total points
ID: 11799396
Hi,

IMHO it would be better to put the uploading in a thread not the animation. If uploading is in the main thread and the animation is in a separate thread then animation will be slower than now (both in one thread) I think. The reason is that only the main thread can show visual components.

Regards, Geo
0
 
LVL 2

Expert Comment

by:Molando
ID: 11800902
Not completely sure what you are saying. if you are creating a webpage that has an upload section, and the animation on the web page starts and stops a lot. then turn the images into an animated gif. the webbrowser viewing your page will then display it fine.

If it is an application you are workign with, then you will need to go with threads. With threads , ask yourself is the task going to be independant of whatever else they are doing. In your example if they are also going to be allowed to do other things when they are uploading, then the uploading should go into a different thread.

Threads can be a bit of a pain, as if you need to access the screen, you need either to send a message from your thread to your main thread(app), or to syncronize. All syncronize is is run the procedure syncronized in the main thread.
Ok, now in English. if you are going to be doing something graphical, do not do it in a thread.

If I was doing this, I would place the upload functionality into a thread. and have that thread send a message back say every 5% processed (or so many seconds) to the main app to update your progress bar.
I would turn your bmp list into an animation. Apart from then being able to use any media playing component, the animation should be smaller. If you wanted to do the animation yourself, then just use a timer, which displays the next bmp image in a TImage component. Have some global integer to keep count of the last image you displayed. what is nice with this is that you can start and stop your timer at will. You did not say how large your image was. if you do get any flicker. then try form1.doublebuffered := true.

Molando
0
 
LVL 1

Author Comment

by:hibbidiji
ID: 11807770
well.   I'll be frank, I dont like the answers but thats because it means work for me, not due to any lack of quality in the answers.   THanks guys.  I will go from here
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question