Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Forcing a form to become the focus

Posted on 2001-08-28
4
Medium Priority
?
138 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 200 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

916 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