Computer Science Canada

Avoiding Keydown Reset

Author:  Flea [ 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"?

Author:  Cervantes [ 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

Author:  Tony [ Mon Nov 22, 2004 4:41 pm ]
Post subject: 

chars array keeps its values untill you call Input.KeyDown again, at which point values get reset.

Author:  Flea [ Mon Nov 22, 2004 8:53 pm ]
Post 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.


: