Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

animated bmp slow... should I use threads?

Posted on 2004-08-13
4
Medium Priority
?
196 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
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…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

604 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