Page 1 of 1

Problems Looping while i wait for a botton

Posted: Sun Oct 25, 2009 3:44 am
by John-G
New Question,

I have a program that i use a "Event = WaitWindowEvent()" to see when i Key is pressed and then does button 1 = case 1 and so far it works very good.
But now i want to watch for a Tone and make it decision on that like the case's but windows will not let me loop anything.
I think It is a problem with my Event = WaitWindowEvent() .. Does anyone there there a better way to watch for Gadget's and still keep looking or am i just missing somethnig

I have it looping but i have to click someplace on the BOX to get it moving?

Thanks John

Code: Select all


 Repeat
     Event = WaitWindowEvent()
     Select Event
       Case #PB_Event_Gadget
         Select EventGadget()
           Case 1 : On()
                      Debug "after read radio case 1"
           Case 1 : Off()
                      Debug "after read radio case 1"
         EndSelect

Until Evemt = #PB_Event_CloseWindow


Re: Problems Looping while i wait for a botton

Posted: Sun Oct 25, 2009 4:09 am
by citystate
try using WindowEvent() instead of WaitWindowEvent()

Code: Select all

Repeat
     Event = WindowEvent()
     Select Event
       Case #PB_Event_Gadget
         Select EventGadget()
           Case 1 : On()
                      Debug "after read radio case 1"
                      Off()
                      Debug "after read radio case 1"
           Default : ;do nothing
         EndSelect

Until Event = #PB_Event_CloseWindow

Re: Problems Looping while i wait for a botton

Posted: Sun Oct 25, 2009 7:33 am
by PB
Actually, use WindowEvent(1) so that it doesn't eat up all CPU.

Re: Problems Looping while i wait for a botton

Posted: Sun Oct 25, 2009 9:29 am
by Kaeru Gaman
you mean WaitWindowEvent( Timeout )
... and a timeout of 10 is sufficent.

Re: Problems Looping while i wait for a botton

Posted: Sun Oct 25, 2009 10:25 am
by PB
> you mean WaitWindowEvent( Timeout )

Yep, typo. :)