I'm encountering a frustrating problem in Delphi.

I've written several very long programs to demonstrate certain things related to neural networks. As such, the program GUI has many things on it that are updated per iteration of the solver: from labels, to memos, to editstrings, etc.

The two main buttons are "Perform one iteration" of the solution process, and "Iterate" which loops the single iteration code based on a spinedit field value.

Everything works perfectly when programming/debugging. The dynamic visual of the screen updates is just what I need for my demonstration.

When the compiled program is run stand-alone, though, the single iteration works fine, and I can click, click, click it. But if I use the looped mode, running 100 iterations, say, so I can stand back and watch the updates, the program goes off to never-never land. The title bar does not say "(Not Responding)", but that's what it feels like. When enough time passes so that the iterations are completed, the screen updates to its final state and the program is okay again. But I want to see the evolution (the two or three Repaints inside each run of the iteration loop).

I don't understand what causes this behavior. I see the same behavior in other recent programs that involve iteration. Is there something I should be doing inside my iteration loop to avoid this behavior?



7 Years
Discussion Span
Last Post by House_of_Dexter

If you are in a tight loop that takes lots of processing power...You never process any of the window messages...It's easy to fix in Applications...just add Application.ProcessMessages in an iteration of your loop. This will allow your windows to process any messages that are in the queue...like repainting and such. There are other tricks...like putting heavily intensive code in it's own thread.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.