Debugging problem

Hi

I have written an interactive skill testing ap to be used as part of our staff training.  The questions are held in a file of records, each record containing the hotspots and allowable keypresses and the filenames of the graphics to load and their sequences.

As the user takes the test, for each question the file is opened and the question is loaded into the same record variable, then the file is closed again.

The tests all work perfectly, but if the user clicks the *Abandon the Test* button (or the *Continue* button when the test is finished), the form is meant to close but instead nothing happens.  I have single-stepped through the code and it definitely runs via the SkillsForm.Close statement.

I have been through my code and reworked all places that had Exit or Break statements to remove them, and I have also removed all recursive routines.

The problem is intermittent but happens often enough to be very annoying - especially if the user has sat 3 or 4 tests.  I think there has got to be a memory issue here, but I cannot see it.  Another strange thing is that the rest of the program will function normally even though the form will not close.

Any ideas??

John
LVL 3
jdthedjAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

BlackTigerXCommented:
that can happen if there is a loop somewhere in your program, like:

while not (True) do //or some other condition
begin
  doSomeStuff;
  Application.ProcessMessages(); //this allows everything to work, but won't allow you to close  your program
end;

do you have any code on the OnClose or OnCloseQuery?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
illusion_chaserCommented:
Hi.
What is Windows version?
What is your Delphi version?
Can you send over code with the problem for testing (to: illusion_chaser@hotmail.com)?

ic
jdthedjAuthor Commented:
Thanks for the replies BlackTigerX and Illusion Chaser

I have found the source of the problem, but I have no idea why it is happening.  So that the program will respond to double clicks I have a timer loop which waits for .75 seconds after the first keypress.  In the OnDoubleClick event of the clicked image the var DoubleClicked is set to True.  For some reason the program goes back to the start of the routine which has the timer code in it, thus starting the timer again and running the subsequent code after that in the same procedure.

I will happily give BlackTigerX the points because that put me on the right track.

Thanx again.

John
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.