Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #13184 > unrolled thread

Timer inside tabbed window

Started byJames Martin <jmmicmc@gmail.com>
First post2020-12-17 14:52 -0800
Last post2020-12-29 21:29 +0100
Articles 8 — 5 participants

Back to article view | Back to comp.lang.clipper.visual-objects


Contents

  Timer inside tabbed window James Martin <jmmicmc@gmail.com> - 2020-12-17 14:52 -0800
    Re: Timer inside tabbed window "Wolfgang Riedmann" <wriedmann@gmail.com> - 2020-12-18 05:26 +0100
      Re: Timer inside tabbed window James Martin <jmmicmc@gmail.com> - 2020-12-18 05:09 -0800
        Re: Timer inside tabbed window "Wolfgang Riedmann" <wriedmann@gmail.com> - 2020-12-21 16:33 +0100
        Re: Timer inside tabbed window "Glen Townsley" <coogee.2015@gmail.com> - 2020-12-22 05:07 +1000
        Re: Timer inside tabbed window Jamal <nospam@example.com> - 2020-12-21 16:03 -0500
          Re: Timer inside tabbed window James Martin <jmmicmc@gmail.com> - 2020-12-28 13:10 -0800
            Re: Timer inside tabbed window "Urs Eggmann" <Urs.Eggmann@shinternet.ch> - 2020-12-29 21:29 +0100

#13184 — Timer inside tabbed window

FromJames Martin <jmmicmc@gmail.com>
Date2020-12-17 14:52 -0800
SubjectTimer inside tabbed window
Message-ID<0ca6223b-ad5f-4219-87e1-62498b361ff7o@googlegroups.com>
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

[toc] | [next] | [standalone]


#13186

From"Wolfgang Riedmann" <wriedmann@gmail.com>
Date2020-12-18 05:26 +0100
Message-ID<i42pbbFj5jlU1@mid.individual.net>
In reply to#13184
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



-- 

[toc] | [prev] | [next] | [standalone]


#13188

FromJames Martin <jmmicmc@gmail.com>
Date2020-12-18 05:09 -0800
Message-ID<01418e2b-dae9-4fd4-b8f7-01ceb13ea010o@googlegroups.com>
In reply to#13186
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
> 
> 
> 
> --

[toc] | [prev] | [next] | [standalone]


#13189

From"Wolfgang Riedmann" <wriedmann@gmail.com>
Date2020-12-21 16:33 +0100
Message-ID<i4btitF11hjU1@mid.individual.net>
In reply to#13188
Hi James,

not every event is passed down to a tab page.
I don't have the time to look at the VO GUI Classes sources, but I
suspect this is also the case for the Timer() method.


Wolfgang

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
> 
> 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
> > 
> > 
> > 
> > --



-- 

[toc] | [prev] | [next] | [standalone]


#13191

From"Glen Townsley" <coogee.2015@gmail.com>
Date2020-12-22 05:07 +1000
Message-ID<rrqrn2$15n8$1@gioia.aioe.org>
In reply to#13188
James,

Why not capture the event in the owner of the tabs and pass it to the 
focused tab page?

Cheers

Glen

"James Martin"  wrote in message 
news:01418e2b-dae9-4fd4-b8f7-01ceb13ea010o@googlegroups.com...

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
>
>
>
> -- 

[toc] | [prev] | [next] | [standalone]


#13192

FromJamal <nospam@example.com>
Date2020-12-21 16:03 -0500
Message-ID<f8fb070e-700a-3f25-80ab-0bee46243c4d@example.com>
In reply to#13188
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

[toc] | [prev] | [next] | [standalone]


#13200

FromJames Martin <jmmicmc@gmail.com>
Date2020-12-28 13:10 -0800
Message-ID<8992a27d-6bd3-400a-aad2-b693df451fb0o@googlegroups.com>
In reply to#13192
This works. Thanks.But it goes to a function outside of the window.I want to run a method of the window I'm running it in. SetTimer(self:handle(),1,1000,@self:RunSome())doesn't work, nor does SetTimer(self:handle(),1,1000,self:RunSome()). I can't send anything SELF as a parameter. 
Running something outside my window is not helping me. Any ideas?

James

On Monday, December 21, 2020 at 4:03:26 PM UTC-5, Jamal wrote:
> 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

[toc] | [prev] | [next] | [standalone]


#13201

From"Urs Eggmann" <Urs.Eggmann@shinternet.ch>
Date2020-12-29 21:29 +0100
Message-ID<i51htaF7f8hU1@mid.individual.net>
In reply to#13200
Hi James,

Some time ago I had this problem also. My solution was as follows:
Install a timer in the owner Window of the TabControl
Each TabWindow has its own method TimTick(oEvent)
The method Dispatch(oEvent) sends the oEvent to each Tab Window
*******************
METHOD dispatch (oEvent) CLASS dtaTimer
IF oEvent:Message==WM_TIMER
DO CASE
CASE oEvent:wParam == 1   // wParam is the ID of the Timer
ASend(SELF:aTabPages , #TimeTick , oEvent) // Impuls an die TabFenster
senden
// aTabPages  is a protect var in the class dtaTimer
// and is filled in the Init as follows:
// SELF:aTabPages := {} // Empfänger für die Zeitimpulse bereitstellen
// FOR nZaehler = 1 TO ALen(SELF:oDCtabTimer:Pages)
// AAdd(SELF:aTabPages , SELF:oDCtabTimer:Pages[nZaehler,3] )
// NEXT nZaehler
// more CASE branches if necessary
ENDCASE
ENDIF
RETURN SUPER:dispatch(oEvent)
*******************
In the Method TimeTick(oEvent) each Window processes the individual method.
See the sample below
*******************
METHOD TimeTick(oE) CLASS Tab_Timer // A timer you van use to boil eggs (g)
* LOCAL cElapsed AS STRING
IF SELF:LAlarmOn == TRUE // Sekundenimpulse durchlassen wenn Timer läuft
SELF:cAlarmSound := SELF:oDCcmbSound:Value // Instanzvariable laufend
aufdatieren
IF oE:Message == WM_TIMER .AND. oE:wParam == 1
SELF:nSekundenTotal -=1 // Gesamtzeit herunterzählen
SELF:nElapsed +=1 // Abgelaufene Zeit zählen
SELF:oDCtxtElapsed:Textvalue := TString(SELF:nElapsed)
IF SELF:nSekundenTotal <= 0
SELF:oDCtxtElapsed:Textvalue := TString(SELF:nElapsed)
Sound( SELF:oDCcmbSound:Value, 1 )
SELF:pbReset()
SELF:oDCtxtAktiv:Textvalue := "Abgelaufen"
SELF:oDCtxtAktiv:show()
ENDIF
ENDIF
ENDIF
RETURN NIL
*******************
So you can process the Timer inside a method of each tab and not in a func
outside.

Is that something you can use?
If necessary I can writ a sample, let me know
Regards
Urs

"James Martin" <jmmicmc@gmail.com> schrieb im Newsbeitrag 
news:8992a27d-6bd3-400a-aad2-b693df451fb0o@googlegroups.com...
This works. Thanks.But it goes to a function outside of the window.I want to 
run a method of the window I'm running it in. 
SetTimer(self:handle(),1,1000,@self:RunSome())doesn't work, nor does 
SetTimer(self:handle(),1,1000,self:RunSome()). I can't send anything SELF as 
a parameter.
Running something outside my window is not helping me. Any ideas?

James

On Monday, December 21, 2020 at 4:03:26 PM UTC-5, Jamal wrote:
> 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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.clipper.visual-objects


csiph-web