How to create endless loop with keypress

Discussion in 'Questions (Windows Mobile)' started by Stellaferox, May 17, 2007.

  1. Stellaferox

    Stellaferox Active Member Licensed User

    Hi,

    In the former days of programming I used an endless loop in a subroutine to keep on going with a keypress to stop. Anybody got an idea how to do this with DO UNTIL or DO WHILE?
    Marc
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    It is better to leave this method for the former days of programming ;)
    It can be achieved using the DoEvents keyword.

    Using events driven programming you could just use the KeyPress event to do what you like.
     
  3. Stellaferox

    Stellaferox Active Member Licensed User

    Yes, Erel, I agree but I want to create an endless loop to keep on going (like bounce a ball against the screensides) without using the timeticksub.
    Marc
     
  4. petrbury

    petrbury Member Licensed User

    Hi, I don't know if it is what you really want, but endless loop you can make this way :

    do until 0 = 1
    doevents
    loop

    Petr
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    There are no OnKey or InKey keywords in Basic4ppc as it is an event driven.
    Why don't you want to use a timer?
     
  6. Stellaferox

    Stellaferox Active Member Licensed User

    The timer is to slow for what I want I think. I solved the problem in a "for next" loop. Now the ball really bounces (see post moving figures)
    Marc
     
  7. Cableguy

    Cableguy Expert Licensed User

    Hi

    were is "Moving figures"??
     
  8. RandomCoder

    RandomCoder Well-Known Member Licensed User

  9. Cableguy

    Cableguy Expert Licensed User

    RandomCoder I don't think that was what he refered to, since he talks abou using a for next loop.
    I think he is preparing a new post?
    Maybe Im wrong, I don't know...
     
  10. RandomCoder

    RandomCoder Well-Known Member Licensed User

    Stellaferox used a for next loop to bounce the ball. I'm presuming that's what he's refering too.

    Regards,
    RandomCoder
     
  11. Stellaferox

    Stellaferox Active Member Licensed User

    Yep, that's right. I tried to use a FORNEXT LOOP but fell back on a DO UNTIL loop that endlessly goes on and bounces the ball to the screensides (see code)
    Marc
     
Loading...