This is what I use (It works on the window, but not inside a tabbed
window):
METHOD StartTimer() AS VOID PASCAL CLASS HttpHuron
try
IF SELF:lTimerInit
SELF:lTimerInit := FALSE
SELF:StopTimer()
ENDIF
// If there is no timer active
Sleep(100)
IF SELF:nTimerHandle == 0
// Create a new times
SELF:nTimerHandle := SetTimer(SELF:handle(),1,1000,NULL_PTR)
// Call the timer Method
SELF:timer()
SELF:lTimerInit := TRUE
SELF:nTimer := 10
SELF:MTimer := SELF:nTimer
Sleep(100)
ENDIF
ENDTryNoReturncatch
* InfoBox{SELF,"Timer Start " + Str(SELF:nTimer),IIF(SELF:lTimerInit,"Started","Not Started")}:Show()
RETURN
James
On Thursday, December 17, 2020 at 11:26:21 PM UTC-5, Wolfgang
Riedmann wrote:
Hi James,
you can use directly the timers from the Windows API.
Please look at the SetTimer() function in the Windows API.
Wolfgang
James Martin wrote:
Does anyone know how to work around this problem. I have several
data windows open inside tabs in a data window. The timers work
well when the windows is opened by itself, but when I open them
inside a tabbed window the timer ticks never reach the window in
the tabbed window. I hope this is not confusing!
To explain the situation better I have one window with a full size
tab control on it. All the other windows are inside these tabs.
This works extremely well as I can tab between the open active
windows any time. But the problem is that I can't use timers!
James
--
Hi James,
you can use directly the timers from the Windows API.
Please look at the SetTimer() function in the Windows API.
Wolfgang
James Martin wrote:
Does anyone know how to work around this problem. I have several data windows open inside tabs in a data window. The timers work well when
the windows is opened by itself, but when I open them inside a tabbed window the timer ticks never reach the window in the tabbed window. I
hope this is not confusing!
To explain the situation better I have one window with a full size
tab control on it. All the other windows are inside these tabs. This
works extremely well as I can tab between the open active windows any
time. But the problem is that I can't use timers!
James
--
This is what I use (It works on the window, but not inside a tabbed window):
METHOD StartTimer() AS VOID PASCAL CLASS HttpHuron
try
IF SELF:lTimerInit
SELF:lTimerInit := FALSE
SELF:StopTimer()
ENDIF
// If there is no timer active
Sleep(100)
IF SELF:nTimerHandle == 0
// Create a new times
SELF:nTimerHandle := SetTimer(SELF:handle(),1,1000,NULL_PTR)
// Call the timer Method
SELF:timer()
SELF:lTimerInit := TRUE
SELF:nTimer := 10
SELF:MTimer := SELF:nTimer
Sleep(100)
ENDIF
ENDTryNoReturncatch
* InfoBox{SELF,"Timer Start " + Str(SELF:nTimer),IIF(SELF:lTimerInit,"Started","Not Started")}:Show()
RETURN
It seems you are mixing up the Window32 API function SetTimer with VO's Self:Timer()!!
I tested the following which works fine using the SetTimer() function:
CLASS TabControl1_Page1 INHERIT DATAWINDOW
//{{%UC%}} USER CODE STARTS HERE (do NOT remove this line)
protect nTimerHandle as DWORD
method PostInit(oWindow,iCtlID,oServer,uExtra) class TabControl1_Page1
//Put your PostInit additions here
? "RegisterTimer"
self:nTimerHandle := SetTimer(self:handle(),1,1000, @Hello())
return NIL
function Hello() as void pascal
? Time() // print current time
return
Jamal
On 12/18/2020 8:09 AM, James Martin wrote:
This is what I use (It works on the window, but not inside a tabbed window):
METHOD StartTimer() AS VOID PASCAL CLASS HttpHuron
try
IF SELF:lTimerInit
SELF:lTimerInit := FALSE
SELF:StopTimer()
ENDIF
// If there is no timer active
Sleep(100)
IF SELF:nTimerHandle == 0
// Create a new times
SELF:nTimerHandle := SetTimer(SELF:handle(),1,1000,NULL_PTR)
// Call the timer Method
SELF:timer()
SELF:lTimerInit := TRUE
SELF:nTimer := 10
SELF:MTimer := SELF:nTimer
Sleep(100)
ENDIF
ENDTryNoReturncatch
* InfoBox{SELF,"Timer Start " + Str(SELF:nTimer),IIF(SELF:lTimerInit,"Started","Not Started")}:Show()
RETURN
It seems you are mixing up the Window32 API function SetTimer with VO's Self:Timer()!!
I tested the following which works fine using the SetTimer() function:
CLASS TabControl1_Page1 INHERIT DATAWINDOW
//{{%UC%}} USER CODE STARTS HERE (do NOT remove this line)
protect nTimerHandle as DWORD
method PostInit(oWindow,iCtlID,oServer,uExtra) class TabControl1_Page1
//Put your PostInit additions here
? "RegisterTimer"
self:nTimerHandle := SetTimer(self:handle(),1,1000, @Hello())
return NIL
function Hello() as void pascal
? Time() // print current time
return
Jamal
On 12/18/2020 8:09 AM, James Martin wrote:
This is what I use (It works on the window, but not inside a tabbed window):
METHOD StartTimer() AS VOID PASCAL CLASS HttpHuron
try
IF SELF:lTimerInit
SELF:lTimerInit := FALSE
SELF:StopTimer()
ENDIF
// If there is no timer active
Sleep(100)
IF SELF:nTimerHandle == 0
// Create a new times
SELF:nTimerHandle := SetTimer(SELF:handle(),1,1000,NULL_PTR)
// Call the timer Method
SELF:timer()
SELF:lTimerInit := TRUE
SELF:nTimer := 10
SELF:MTimer := SELF:nTimer
Sleep(100)
ENDIF
ENDTryNoReturncatch
* InfoBox{SELF,"Timer Start " + Str(SELF:nTimer),IIF(SELF:lTimerInit,"Started","Not Started")}:Show()
RETURN
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 286 |
Nodes: | 16 (3 / 13) |
Uptime: | 91:44:26 |
Calls: | 6,498 |
Calls today: | 9 |
Files: | 12,100 |
Messages: | 5,277,697 |