Solved

Forcing a form to become the focus

Posted on 2001-08-28
4
133 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
[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
  • 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
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…

762 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