Sub waiting for a timer

K

Ken Kast

I have the following app logic:

1. A form frmMain shows another modeless form. The second form is stored in
a private variable ScrnTip in frmMain. A system timer is set to close the
form.
2. frmMain handles a mouse event. The handler calls a proc Hide which is
supposed to kill the timer and close ScrnTip.
3. Hide pauses at the first line that references ScrnTip, continues
execution after the timer has elapsed.

If I don't cause the mouse event, so Hide doesn't get called (the timer
handler just closes ScrnTip), everything works fine.

Without seeing code, can someone tell me what's going on?

Ken
 
C

Cor

Hi Ken,
Difficult to answer only this line can be that what brings the problem.
2. frmMain handles a mouse event. The handler calls a proc Hide which is
supposed to kill the timer and close ScrnTip.

A system.timers.timer can, as far as I know till now, not be killed (unless
you pull of the power).

Could that be the problem?

Cor
 
K

Ken Kast

I'm using the Stop() method, which, according to the documentation, is
supposed to keep the timer from raising the elapsed event. That's enough
killing for me. Even if that didn't work, why would other process seem to
go into limbo when I address the form? The form and the timer have no
relationship, i.e., the form doesn't know there's a handler lying in wait to
close it.

Ken
 
K

Ken Kast

OK, I took the timer out, and it's still halting when it comes to the line
that accesses ScrnTip (the variable in the first form holding a ref to the
second form). So it must have to do with having spawned a modeless form
from the first form.

Ken

Ken
 
K

Ken Kast

It's hanging at the line ScrnTip.Close(). The Closing event is not raised
in the second (ScrnTip) form.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top