Solved

Forcing a form to become the focus

Posted on 2001-08-28
4
132 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

856 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