Solved

Forcing a form to become the focus

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
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…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

910 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

21 Experts available now in Live!

Get 1:1 Help Now