Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

stop the timer

Status
Not open for further replies.

JaneJantz

Programmer
Sep 13, 2000
55
US
I have an app that must constantly update a grid on the screen as records are being added from another source. This is on a timer with interval=4000. This works great, but sometimes I want to stop the timer and add further notes to one of the records. I try to stop the timer so that I can focus on another form, but I can't get the timer to stop.. keeps going back to the first form in the middle of my new form.
I have set thisform.timer.enable=.f., and the interval to 0 and reset the timer before I call the new form.. but can't get it to stop going back to the first form and updating the grid. The new form is modal. Any suggestions?
 
Have you tried using SetFocus to access the form you want to modify?

-Steve
 
Yes, tried to setfocus on the new form, but the timer event won't give up the old form to the new form.
Any other suggestions?
 
Suggest ... set the visible Property of the First form to .f. when the second form is activated and then when returned, make that .t. ramani :)
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com
 
Thanks, Ramani, but that does not stop the timer either... The first form has a grid which updates with a timer event to refresh the grid... the new form opens up another table with a text field to put in notes, then when done, closes the table and releases the new form back to the old one. The visible property does not stop the timer...
any other suggestions... is there no way to stop and restart a timer event?
 
Disabling a Timer control by setting Enabled to false (.F.) cancels the countdown specified by the Timer control's Interval property.
So Set MyTimer.Enabled = .f.
DO new form
Set MyTimer.Enabled = .t. when returned
ramani :)
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com
 
That's what I read too, but it doesn't seem to work... tried the enabled=.f., that did not work... added interval=0... that did not work, made the new form modal... that did not work... what else can I do?
 
make the interval to a very large number and after the return set it back to yor preferred number ramani :-9
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com
 
After issuing the timer interval or enabled, are you doing MyTimer.Reset() ?. May the timer is not reset at all. This can solve the problem. ramani :-9
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com
 
I have the reset after I set the new interval, but it doesn't seem to be resetting it... set the interval to 2,000,000,000... but still going back to the first form too quickly...
 
WHat I am suggesting now is not directly attacking the problem .. but finding a solution as a workaround.. since I do not know why you are facing the problem.

In the timer InitEvent put the code,
This.Enabled = ! MyNewFormRun

Add a logical property in the 1st form - MyNewFormRun
Initialise it to .f.
When you switch to second form, set this to .t. and when you get back make this to .f.

Let us see what happens. Hope you get a solution
ramani :-9
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com
 
I think I found it... I was trying to run the new form as a top-level form, and even tho it was modal, it returned processing to the first form immediately, which turned back on the timer. I have to run the new form inside the old one. Unless you know of another way. I did not do this at first because the first form was not large enough for the new form.
 
Man, hit the darn timer in the heart. Try to remove him for good. I don't know here U add him but use the remove event. After doing your job recreate it. Have fun !
 
I'm pretty new to this, but here goes... You are working in an OPP platform so if you call one form from within another, control returns to the calling form as soon as the called form is activated, so any code following the call to the new form is also ran.
___________________________
so runnung:

MyTimer.Enabled = .f.
DO form Mynewform
MyTimer.Enabled = .t.

turns the timer off, runs the form "Mynewform" and then turns the timer on again as soon as "Mynewform" is activated.
___________________________

You would need to run the new form using a "Createobject" command so that control only returns to the calling form when the new form is hidden/detroyed.

Hope this helps

Gemmall
 
I think the createobject will work... what I finally did was reset the timer to 200000000 which gave me plenty of time to do my new form... then reset it back to 4000. Also, instead of running the new form on the desktop, I changed the size of the first form to hold the new form, then ran the new form inside the first form. Seems to work... thanks for the help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top