Hi guys!
can you help me how to change Interval in TIMER control?
I can't find it anywhere...
How to change Interval in TIMER control?
Moderator: Rathinagiri
Re: How to change Interval in TIMER control?
Hello
I have found this code in Giovanni's HMG Tutorial:
/*
#include "hmg.ch"
FUNCTION Main()
DEFINE WINDOW Form_1 ;
AT 90,90 ;
WIDTH 250 ;
HEIGHT 150 ;
MAIN
END WINDOW
DEFINE TIMER tempo ;
PARENT Form_1 ;
INTERVAL 1000 ;
ACTION print_clock()
Form_1.Activate
RETURN NIL
FUNCTION print_clock()
Form_1.title := time()
RETURN NIL
*/
perhaps this may help you.
Regards
I have found this code in Giovanni's HMG Tutorial:
/*
#include "hmg.ch"
FUNCTION Main()
DEFINE WINDOW Form_1 ;
AT 90,90 ;
WIDTH 250 ;
HEIGHT 150 ;
MAIN
END WINDOW
DEFINE TIMER tempo ;
PARENT Form_1 ;
INTERVAL 1000 ;
ACTION print_clock()
Form_1.Activate
RETURN NIL
FUNCTION print_clock()
Form_1.title := time()
RETURN NIL
*/
perhaps this may help you.
Regards
- mustafa
- Posts: 1162
- Joined: Fri Mar 20, 2009 11:38 am
- DBs Used: DBF
- Location: Alicante - Spain
- Contact:
Re: How to change Interval in TIMER control?
Hi Mol
Regards
Mustafa
Code: Select all
DEFINE WINDOW Form_1 ;
AT 0, 0 ;
WIDTH 405 HEIGHT 405 ;
TITLE "" ;
MAIN
ON KEY ESCAPE ACTION Form_1.Release )
DEFINE TIMER Timer_1 INTERVAL 1000 ACTION (RELEASE MEMORY)
DEFINE TIMER Timer_2 ;
INTERVAL 100 ;
ACTION { || thisWindow.Row := 175, thisWindow.Col := 480 } // <== Does not let the window move
...
Regards
Mustafa
Re: How to change Interval in TIMER control?
Form_1.Timer_1.Value := nInterval //change timer's interval
You can only set new interval, can't read actual value by "Value"
You can read interval by: _HMG_SYSDATA [ 8 ] [ GetControlIndex (ControlName,ParentForm) ] => timer's interval current value
The sample:
You can only set new interval, can't read actual value by "Value"
You can read interval by: _HMG_SYSDATA [ 8 ] [ GetControlIndex (ControlName,ParentForm) ] => timer's interval current value
The sample:
Code: Select all
#include "hmg.ch"
Function Main
DEFINE WINDOW Form_1 ;
AT 0,0 ;
WIDTH 400 ;
HEIGHT 400 ;
TITLE 'Timer Test' ;
MAIN
DEFINE TIMER Timer_1 ;
INTERVAL 3000 ;
ACTION TimerTest()
END WINDOW
ACTIVATE WINDOW Form_1
Return
Procedure TimerTest()
Local nInterval := _HMG_SYSDATA [ 8 ] [ GetControlIndex ( 'Timer_1', 'Form_1') ] // timer's interval current value
Form_1.Timer_1.Enabled := .F.
MsgInfo ('Timer ' + hb_ValToStr ( nInterval / 1000 ) + ' sec.')
IF nInterval > 1000
nInterval -= 1000
Form_1.Timer_1.Value := nInterval //change timer's interval
ENDIF
Form_1.Timer_1.Enabled := .T.
Return