From: ciderbob on
I am using SetTimer(self:handle(),1,100,null_ptr) in a data window to
display progress of the window in VO 2.8sp2
CLASS waitwin INHERIT DATAWINDOW

EXPORT oDCctext AS FIXEDTEXT

//{{%UC%}} USER CODE STARTS HERE (do NOT remove this line)
EXPORT pbrect,opie,npos:=0 ,cpos:=0
PROTECT nl
PROTECT xc
PROTECT yc
PROTECT x
PROTECT y
PROTECT c
PROTECT oline
PROTECT a
PROTECT r
PROTECT rgb
PROTECT i
PROTECT j
PROTECT p
PROTECT cnt
PROTECT angle
PROTECT nstep

method Init(oWindow,iCtlID,oServer,uExtra) class waitwin
local dim aFonts[1] AS OBJECT
local dim aBrushes[1] AS OBJECT

self:PreInit(oWindow,iCtlID,oServer,uExtra)

super:Init(oWindow,ResourceID{"waitwin",_GetInst()},iCtlID)

aFonts[1] := Font{,10,"Technical"}
aBrushes[1] := Brush{Color{219,219,219}}

oDCctext := FixedText{self,ResourceID{WAITWIN_CTEXT,_GetInst()}}
oDCctext:Font(aFonts[1], FALSE)
oDCctext:TextColor := Color{255,0,0}
oDCctext:HyperLabel := HyperLabel
{#ctext,NULL_STRING,NULL_STRING,NULL_STRING}
oDCctext:BackGround := aBrushes[1]

self:Caption := "Please wait"
self:HyperLabel := HyperLabel{#waitwin,"Please
wait",NULL_STRING,NULL_STRING}
Self:BackGround := aBrushes[1]

if !IsNil(oServer)
self:Use(oServer)
endif

self:PostInit(oWindow,iCtlID,oServer,uExtra)

return self

METHOD PostInit(oWindow,iCtlID,oServer,uExtra) CLASS waitwin
LOCAL i,j
nl:=SELF:size:height/2 // 30
xc:=SELF:size:width/2 //100
yc:=65
x:=ARRAY(nl)
y:=ARRAY(nl)
c:=ARRAY(nl)
a:=ARRAY(nl)
r:=25
rgb:=192
p:=ARRAY(nl)
cnt:=1
angle:=90
nstep:=-5
SELF:origin:=centerscreenwin(SELF)
SELF :EnableSystemMenu(FALSE)
SetTimer(SELF:handle(),1,10,NULL_PTR )
SELF:odcctext:caption:=AsString(uextra)
FOR i:=1 TO nl
j:=rgb/nl*(i-1)
c[i] := Pen{Color{j,j,j}, LINESOLID, 1}
NEXT
SELF:background:=brush{color{rgb,rgb,rgb}}
SELF:odcctext:background:= brush{color{rgb,rgb,rgb}}
c[nl] := Pen{Color{rgb,rgb,rgb}, LINESOLID, 1}
AltD()
RETURN NIL



METHOD dispatch(oe) CLASS waitwin
LOCAL i ,j
IF oE:message == WM_TIMER .AND. oE:wParam == 1
AltD()
oprinter:idle()
FOR j:=nl-1 TO 1 STEP -1
IF y[j] != NIL
x[j+1]:=x[j]
y[j+1]:=y[j]
ENDIF
NEXT
a[cnt]:=angle
x[1] := (Cos(3.14159/180*a[cnt]) * r ) + xc
y[1] := (Sin(3.14159/180*a[cnt]) * r) + yc
p[1] := c[1]
cc:=nl
FOR j:=1 TO nl
IF y[j] != NIL
oline:=LineObject{point{xc,yc},point{x[j],y[j]},c[j])
SELF:draw(oline)
ENDIF
cc--
NEXT
cnt++
cnt:=if(cnt>nl,1,cnt)
IF i==-270
I:=90
ENDIF
SELF:angle-=5
SELF:angle:=if(SELF:angle<-270,90,SELF:angle)
ENDIF
RETURN SUPER:dispatch(oe)


It works fine in 2.7 but in 2.8 the dispatch never receives the
WM_TIMER in the event

It's most likely somthing obvious but it has me flummoxed

TIA

Bob McCutcheon
From: Kevin on
Bob,

There is a method in VO28 called RegisterTimer which takes the interval
and a logical. It triggers a method called Timer. The logical indicates
if the timer is called only once or not. Check the help file for more
information.

Hope this helps.

Kevin

"ciderbob" <bobmcc03(a)gmail.com> wrote in message
news:bb4ae14f-fdbc-4169-879d-5afd267e0c5e(a)v25g2000yqk.googlegroups.com:

> I am using SetTimer(self:handle(),1,100,null_ptr) in a data window to
> display progress of the window in VO 2.8sp2
> CLASS waitwin INHERIT DATAWINDOW
>
> EXPORT oDCctext AS FIXEDTEXT
>
> //{{%UC%}} USER CODE STARTS HERE (do NOT remove this line)
> EXPORT pbrect,opie,npos:=0 ,cpos:=0
> PROTECT nl
> PROTECT xc
> PROTECT yc
> PROTECT x
> PROTECT y
> PROTECT c
> PROTECT oline
> PROTECT a
> PROTECT r
> PROTECT rgb
> PROTECT i
> PROTECT j
> PROTECT p
> PROTECT cnt
> PROTECT angle
> PROTECT nstep
>
> method Init(oWindow,iCtlID,oServer,uExtra) class waitwin
> local dim aFonts[1] AS OBJECT
> local dim aBrushes[1] AS OBJECT
>
> self:PreInit(oWindow,iCtlID,oServer,uExtra)
>
> super:Init(oWindow,ResourceID{"waitwin",_GetInst()},iCtlID)
>
> aFonts[1] := Font{,10,"Technical"}
> aBrushes[1] := Brush{Color{219,219,219}}
>
> oDCctext := FixedText{self,ResourceID{WAITWIN_CTEXT,_GetInst()}}
> oDCctext:Font(aFonts[1], FALSE)
> oDCctext:TextColor := Color{255,0,0}
> oDCctext:HyperLabel := HyperLabel
> {#ctext,NULL_STRING,NULL_STRING,NULL_STRING}
> oDCctext:BackGround := aBrushes[1]
>
> self:Caption := "Please wait"
> self:HyperLabel := HyperLabel{#waitwin,"Please
> wait",NULL_STRING,NULL_STRING}
> Self:BackGround := aBrushes[1]
>
> if !IsNil(oServer)
> self:Use(oServer)
> endif
>
> self:PostInit(oWindow,iCtlID,oServer,uExtra)
>
> return self
>
> METHOD PostInit(oWindow,iCtlID,oServer,uExtra) CLASS waitwin
> LOCAL i,j
> nl:=SELF:size:height/2 // 30
> xc:=SELF:size:width/2 //100
> yc:=65
> x:=ARRAY(nl)
> y:=ARRAY(nl)
> c:=ARRAY(nl)
> a:=ARRAY(nl)
> r:=25
> rgb:=192
> p:=ARRAY(nl)
> cnt:=1
> angle:=90
> nstep:=-5
> SELF:origin:=centerscreenwin(SELF)
> SELF :EnableSystemMenu(FALSE)
> SetTimer(SELF:handle(),1,10,NULL_PTR )
> SELF:odcctext:caption:=AsString(uextra)
> FOR i:=1 TO nl
> j:=rgb/nl*(i-1)
> c[i] := Pen{Color{j,j,j}, LINESOLID, 1}
> NEXT
> SELF:background:=brush{color{rgb,rgb,rgb}}
> SELF:odcctext:background:= brush{color{rgb,rgb,rgb}}
> c[nl] := Pen{Color{rgb,rgb,rgb}, LINESOLID, 1}
> AltD()
> RETURN NIL
>
>
>
> METHOD dispatch(oe) CLASS waitwin
> LOCAL i ,j
> IF oE:message == WM_TIMER .AND. oE:wParam == 1
> AltD()
> oprinter:idle()
> FOR j:=nl-1 TO 1 STEP -1
> IF y[j] != NIL
> x[j+1]:=x[j]
> y[j+1]:=y[j]
> ENDIF
> NEXT
> a[cnt]:=angle
> x[1] := (Cos(3.14159/180*a[cnt]) * r ) + xc
> y[1] := (Sin(3.14159/180*a[cnt]) * r) + yc
> p[1] := c[1]
> cc:=nl
> FOR j:=1 TO nl
> IF y[j] != NIL
> oline:=LineObject{point{xc,yc},point{x[j],y[j]},c[j])
> SELF:draw(oline)
> ENDIF
> cc--
> NEXT
> cnt++
> cnt:=if(cnt>nl,1,cnt)
> IF i==-270
> I:=90
> ENDIF
> SELF:angle-=5
> SELF:angle:=if(SELF:angle<-270,90,SELF:angle)
> ENDIF
> RETURN SUPER:dispatch(oe)
>
>
> It works fine in 2.7 but in 2.8 the dispatch never receives the
> WM_TIMER in the event
>
> It's most likely somthing obvious but it has me flummoxed
>
> TIA
>
> Bob McCutcheon

From: ciderbob on
I tried Registertimer and had the same results the function was never
called and it will only take integers for the interval. I want to
update several times a second.

I played around with making the window a datadialog and it worked but
it was a modal window and did not allow the calling process to
continue until it was closed.

Can you make a datadialog windoe modeless?

Bob
From: Kevin on
Bob,

I use the timer to rotate the display of images on a datawindow and it
seems to work for me. All the time method does is call another method of
the window. The interval setting for the RegisterTimer works for me in
this case.

To be honest I don't know if the datadialog could be made modeless or
not.

Kevin


"ciderbob" <bobmcc03(a)gmail.com> wrote in message
news:e38b6321-1150-4711-8a5d-0017b90a6b26(a)g27g2000yqn.googlegroups.com:

> I tried Registertimer and had the same results the function was never
> called and it will only take integers for the interval. I want to
> update several times a second.
>
> I played around with making the window a datadialog and it worked but
> it was a modal window and did not allow the calling process to
> continue until it was closed.
>
> Can you make a datadialog windoe modeless?
>
> Bob

From: Geoff Schaller on
Bob,

There is almost no chance your timer isn't working. It is more a case of
your dispatch doing something that you can see. Send a debug string to
dbgview, doing nothing else. Also, what is the return value when you set
the timer? But here, 10ms is awefully fast. Try 100ms first but it
should be working.

Alternately, set up a sample datawindow for us all to play with for you.

Geoff



"ciderbob" <bobmcc03(a)gmail.com> wrote in message
news:bb4ae14f-fdbc-4169-879d-5afd267e0c5e(a)v25g2000yqk.googlegroups.com:

> I am using SetTimer(self:handle(),1,100,null_ptr) in a data window to
> display progress of the window in VO 2.8sp2
> CLASS waitwin INHERIT DATAWINDOW
>
> EXPORT oDCctext AS FIXEDTEXT
>
> //{{%UC%}} USER CODE STARTS HERE (do NOT remove this line)
> EXPORT pbrect,opie,npos:=0 ,cpos:=0
> PROTECT nl
> PROTECT xc
> PROTECT yc
> PROTECT x
> PROTECT y
> PROTECT c
> PROTECT oline
> PROTECT a
> PROTECT r
> PROTECT rgb
> PROTECT i
> PROTECT j
> PROTECT p
> PROTECT cnt
> PROTECT angle
> PROTECT nstep
>
> method Init(oWindow,iCtlID,oServer,uExtra) class waitwin
> local dim aFonts[1] AS OBJECT
> local dim aBrushes[1] AS OBJECT
>
> self:PreInit(oWindow,iCtlID,oServer,uExtra)
>
> super:Init(oWindow,ResourceID{"waitwin",_GetInst()},iCtlID)
>
> aFonts[1] := Font{,10,"Technical"}
> aBrushes[1] := Brush{Color{219,219,219}}
>
> oDCctext := FixedText{self,ResourceID{WAITWIN_CTEXT,_GetInst()}}
> oDCctext:Font(aFonts[1], FALSE)
> oDCctext:TextColor := Color{255,0,0}
> oDCctext:HyperLabel := HyperLabel
> {#ctext,NULL_STRING,NULL_STRING,NULL_STRING}
> oDCctext:BackGround := aBrushes[1]
>
> self:Caption := "Please wait"
> self:HyperLabel := HyperLabel{#waitwin,"Please
> wait",NULL_STRING,NULL_STRING}
> Self:BackGround := aBrushes[1]
>
> if !IsNil(oServer)
> self:Use(oServer)
> endif
>
> self:PostInit(oWindow,iCtlID,oServer,uExtra)
>
> return self
>
> METHOD PostInit(oWindow,iCtlID,oServer,uExtra) CLASS waitwin
> LOCAL i,j
> nl:=SELF:size:height/2 // 30
> xc:=SELF:size:width/2 //100
> yc:=65
> x:=ARRAY(nl)
> y:=ARRAY(nl)
> c:=ARRAY(nl)
> a:=ARRAY(nl)
> r:=25
> rgb:=192
> p:=ARRAY(nl)
> cnt:=1
> angle:=90
> nstep:=-5
> SELF:origin:=centerscreenwin(SELF)
> SELF :EnableSystemMenu(FALSE)
> SetTimer(SELF:handle(),1,10,NULL_PTR )
> SELF:odcctext:caption:=AsString(uextra)
> FOR i:=1 TO nl
> j:=rgb/nl*(i-1)
> c[i] := Pen{Color{j,j,j}, LINESOLID, 1}
> NEXT
> SELF:background:=brush{color{rgb,rgb,rgb}}
> SELF:odcctext:background:= brush{color{rgb,rgb,rgb}}
> c[nl] := Pen{Color{rgb,rgb,rgb}, LINESOLID, 1}
> AltD()
> RETURN NIL
>
>
>
> METHOD dispatch(oe) CLASS waitwin
> LOCAL i ,j
> IF oE:message == WM_TIMER .AND. oE:wParam == 1
> AltD()
> oprinter:idle()
> FOR j:=nl-1 TO 1 STEP -1
> IF y[j] != NIL
> x[j+1]:=x[j]
> y[j+1]:=y[j]
> ENDIF
> NEXT
> a[cnt]:=angle
> x[1] := (Cos(3.14159/180*a[cnt]) * r ) + xc
> y[1] := (Sin(3.14159/180*a[cnt]) * r) + yc
> p[1] := c[1]
> cc:=nl
> FOR j:=1 TO nl
> IF y[j] != NIL
> oline:=LineObject{point{xc,yc},point{x[j],y[j]},c[j])
> SELF:draw(oline)
> ENDIF
> cc--
> NEXT
> cnt++
> cnt:=if(cnt>nl,1,cnt)
> IF i==-270
> I:=90
> ENDIF
> SELF:angle-=5
> SELF:angle:=if(SELF:angle<-270,90,SELF:angle)
> ENDIF
> RETURN SUPER:dispatch(oe)
>
>
> It works fine in 2.7 but in 2.8 the dispatch never receives the
> WM_TIMER in the event
>
> It's most likely somthing obvious but it has me flummoxed
>
> TIA
>
> Bob McCutcheon