Solved

animated bmp slow... should I use threads?

Posted on 2004-08-13
4
180 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now