Re: Timer

new topic     » goto parent     » topic index » view thread      » older message » newer message

Michelle, 

I think the problem is you've got your onOpen[] and onTime[] AFTER the
call to WinMain.  This means the event handler is not set until WinMain
returns, which is at the end of the program.

Jonas

> > >
> > > without warning
> > > include win32lib.ew
> > >
> > > constant
> > >   dummywin=create(Window,"A Timer",0,0,0,300,300,0),
> > >   dummytext=create(LText,"Beginning text",dummywin,10,10,100,40,0)
> > >
> > >
> > > integer mytimer,timerint
> > > timerint=0
> > > mytimer=-1
> > >
> > > global procedure onOpen_dummywin()
> > > warnErr("open")
> > >  setText(dummytext,"It's open")
> > >    setTimer(dummywin,mytimer,1000)
> > > end procedure
> > >
> > > global procedure onTimer_dummywin(object val)
> > >   timerint=timerint+1
> > >   setText(dummytext,"Timer:  "&sprint(timerint))
> > > end procedure
> > >

These should be here:
onOpen[dummywin]=routine_id("onOpen_dummywin")
onTimer[dummywin]=routine_id("onTimer_dummywin")

> > > WinMain(dummywin,Normal)
> > >

Not here:
> > > onOpen[dummywin]=routine_id("onOpen_dummywin")
> > > onTimer[dummywin]=routine_id("onTimer_dummywin")
> > >
> > >

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu