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

Username:   Password: 
 RegisterRegister   
 Avoiding Keydown Reset
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Flea




PostPosted: Mon Nov 22, 2004 3:21 pm   Post subject: Avoiding Keydown Reset

code:
   
Input.KeyDown (chars)
if chars (KEY_ENTER) then
     boolean1 := true
end if


In a case like this, boolean1 becomes false as soon as enter is released. there any way to avoid this, so the keydown works similar to a getch in the way that it actually gets the information "permanantly"?
Sponsor
Sponsor
Sponsor
sponsor
Cervantes




PostPosted: Mon Nov 22, 2004 4:05 pm   Post subject: Re: Avoiding Keydown Reset

Flea wrote:
code:
   
Input.KeyDown (chars)
if chars (KEY_ENTER) then
     boolean1 := true
end if


In a case like this, boolean1 becomes false as soon as enter is released.

oh?

code:

var chars : array char of boolean
var boolean1 := false
loop
    Input.KeyDown (chars)
    if chars (KEY_ENTER) then
        boolean1 := true
    end if
    locate (1, 1)
    put boolean1
end loop
Tony




PostPosted: Mon Nov 22, 2004 4:41 pm   Post subject: (No subject)

chars array keeps its values untill you call Input.KeyDown again, at which point values get reset.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Flea




PostPosted: Mon Nov 22, 2004 8:53 pm   Post subject: (No subject)

Oops... i dont know what i was thinking. For some reason i had always thought that as soon as the key was released the variable reset..

anyway thx good to know exactly whats goin on there, and i found what was wrong with my code.
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: