Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Please help me exit this loop
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
bushnerd




PostPosted: Tue Dec 27, 2005 9:21 pm   Post subject: Please help me exit this loop

I am using the getch command and am trying to exit the loop when the box is clicked. Any idea what I am doing wrong, or how to improve this?



code:
procedure playbox
    cls
    demonstrationintro
    var note : string (1)
    var xmouse, ymouse, button : int
    mousewhere (xmouse, ymouse, button)
    drawfillbox (275, 260, 335, 320, 4)
    locatexy (280, 245)
    put "Exit"
    loop

        getch (note)
        if note = "1" then
            note2C
        elsif note = "2" then
            note4C
        elsif note = "3" then
            note2D
        elsif note = "4" then
            note4D
        elsif note = "5" then
            note2E
        elsif note = "6" then
            note4E
        elsif note = "7" then
            note2G
        elsif note = "8" then
            note4G
        end if
        exit when xmouse >= 275 and xmouse <= 335 and ymouse >= 260 and ymouse <= 320 and button = 1
    end loop
end playbox


thanks
Sponsor
Sponsor
Sponsor
sponsor
MysticVegeta




PostPosted: Tue Dec 27, 2005 9:29 pm   Post subject: (No subject)

No you dont have to use getch. Check Input.KeyDown if you have Turing 4.0.5
MysticVegeta




PostPosted: Tue Dec 27, 2005 9:36 pm   Post subject: (No subject)

Also. The mousewhere should be inside the loop because otherwise it would just take one position (thestarting one)
bushnerd




PostPosted: Tue Dec 27, 2005 10:26 pm   Post subject: (No subject)

Thank you, putting the mousewhere inside the loop did the trick. I was justing using the getch command just to get the program to work so that I have to do minor editing in class. We have to use parallelget to get input from a push button box that we will have made. Thanks again.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: