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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Menu Bar Timeout

Status
Not open for further replies.

TSWA

IS-IT--Management
Sep 27, 2001
66
PA
Hello, I want to know if is posible to use TIMER(similar to Timer in Forms) into MENU BAR to close the aplications after a period of Time(like 5 minutes) if nobody is using the program.

In my MAIN.PRG I have these codes:

do PROGS\OPENTABLES1
DO PROGS\MENU01.MPR
READ EVENTS

Is working fine, but when I want to do maintenance, I have many Workstation with the aplication opened(the aplication users works 24 hours and is located around 50,15,10 miles from my Office) and sometimes nobody are in the office.

During the maintenance one routine is Indexing Tables and I need open the Tables Exclusive.

Thanks in advance(sorry for my english),

Best regards from Panama,

Marlon
 
TSWA

Add your timer to the _screen (the background part of your application)
_screen.AddObject("timer1","timer")

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Hi Mike, thanks for your fast response.

I want to know how can stop and begin the timer reset programatically. Example, If I execute a routine(select a Item of the menu) I want stop the counter and after release the Form, the counter will begin again.

I know how work the Timer Object, but, I don't know how can do that or what sentence I need.

Thanks

Best regards from Panama,

Marlon
 
In order to completly control the timer,use a timer class. Define the class in your main program (below starting at the word define) and when you need to timer, use the two first lines. You can adjust the interval to suit your needs, and in order to reset it you can add a line in the Timer Event to resset the timer interval to its original value.

Code:
Public oTimer
oTimer = Createobject("timer1")
Define Class timer1 As Timer
	Procedure Timer
	Local nAnswer
	nAnswer = Messagebox("You haven't done anything for the last 10 seconds,"+CHR(13)+" are you sure you want to quit?",4)
	If nAnswer = 6
		Quit
	Endif

Endproc
Interval = 10000 && Ten seconds
Enddefine

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Hi Marlon,

If I execute a routine(select a Item of the menu) I want stop the counter and after release the Form, the counter will begin again.

In addition to what Mike said, you can use Interval or Enabled properties to do what you want. i.e.:
Code:
oTimer.Interval = 0
Do Form MyForm
oTimer.Interval = 10000
or
Code:
oTimer.Enabled = .F.
Do Form MyForm
oTimer.Enabled = .T.

Regards


-- AirCon --
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top