Solved

Forcing a form to become the focus

Posted on 2001-08-28
4
129 Views
Last Modified: 2010-04-06
Ok I have what is likely a dumb question, but I want to see if there's an answer. I'm writing a program that will convert datafiles from one format to another. I have everything working, with one small problem (or two, depending on how you look at it)

When the program runs and is not waiting for the user to do something (i.e. reading in old data record, writing new data record, ect..) the system treats the program as if it were not responding. Ctl-Alt-Delete shows the program not responding, and if it looses the focus (i.e. someone opens another window that covers the program) it does not re-appear till it complete's it's job and waits for the user to confirm a message that is displayed. I tried calling Form.Repaint every loop but that did not help. It still won't be visible and still shows as not responding.

Is there a way to make sure windows knows the program IS responding when it's running? If so, what do I need to do? Will that allow the form to be re-displayed if a window is opened on top if it, and then later removed? (closed, minimized, moved, ect...)

Thanks!
0
Comment
Question by:DanEgli
  • 2
  • 2
4 Comments
 
LVL 17

Accepted Solution

by:
inthe earned 50 total points
ID: 6433428
Hi,
in your loop you should call Application.ProcessMessages;
this will cause your program to repaint itself etc..

Regards Barry
0
 
LVL 1

Author Comment

by:DanEgli
ID: 6433501
Great! Thanks. That is working great. It has one or two small glitches but thats ok. I don't suppose you can help me with this one:

when I swap another window onto the app, then swap back, the animation cell I have on the form will be stuck at whatever position it was at before until the animation loop completes, then it starts over and is working. Is there a way to make the animation proceed in the background so that when the app is swapped back it does not stick the amination cell?

Thanks!
0
 
LVL 17

Expert Comment

by:inthe
ID: 6433783
>>animation cell I have on the form

using TAnimate by any chance ;-)
i know this bug though not a workaround except maybe you wanna look at tgifimage :
http://www.melander.dk/delphi/gifimage/
you can then load animated gifs into a timage instead of using the animate comp.
0
 
LVL 1

Author Comment

by:DanEgli
ID: 6433937
It was a Tanimate. I may just kill it. I had it on there originally because I wanted people to know the program was working despite it appearing frozen. Now that it doesn't appear frozn, that kills the need for the tanimate :>
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

708 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

18 Experts available now in Live!

Get 1:1 Help Now