Problems Looping while i wait for a botton

Just starting out? Need help? Post your questions and find answers here.
John-G
User
User
Posts: 52
Joined: Wed Oct 03, 2007 5:13 pm
Location: Pittsburgh,Pa.
Contact:

Problems Looping while i wait for a botton

Post 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

citystate
Enthusiast
Enthusiast
Posts: 638
Joined: Sun Feb 12, 2006 10:06 pm

Re: Problems Looping while i wait for a botton

Post 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
there is no sig, only zuul (and the following disclaimer)

WARNING: may be talking out of his hat
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: Problems Looping while i wait for a botton

Post by PB »

Actually, use WindowEvent(1) so that it doesn't eat up all CPU.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Re: Problems Looping while i wait for a botton

Post by Kaeru Gaman »

you mean WaitWindowEvent( Timeout )
... and a timeout of 10 is sufficent.
oh... and have a nice day.
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: Problems Looping while i wait for a botton

Post by PB »

> you mean WaitWindowEvent( Timeout )

Yep, typo. :)
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
Post Reply