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

Username:   Password: 
 RegisterRegister   
 Left or right shift detection
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Mayb123




PostPosted: Fri Dec 07, 2007 1:20 pm   Post subject: Left or right shift detection

hey to all who enter this thread. i was wondering if there was a way to determine which shift key is being pressed. i'm using Input.Keydown and i want an event to occur only when the left shift key is being pressed. any input?... anyone?
Sponsor
Sponsor
Sponsor
sponsor
Ultrahex




PostPosted: Fri Dec 07, 2007 1:48 pm   Post subject: Re: Left or right shift detection

I do not believe this is possible, look at Keyboard Module for more information.

Note that Left Shift is << and Right Shift is >> in reality.

http://ascii-table.com/pronunciation-guide.php for more information about ASCII
Mazer




PostPosted: Fri Dec 07, 2007 4:28 pm   Post subject: RE:Left or right shift detection

He's talking about checking modifier keys, not bit shifting.
CodeMonkey2000




PostPosted: Fri Dec 07, 2007 9:57 pm   Post subject: RE:Left or right shift detection

I don't think there is anyway to differentiate between the two in turing.
code:
var a : array char of boolean
loop
    Input.KeyDown (a)
    for x : 0 .. 255
        if a (chr (x)) then
            put x
        end if
    end for
end loop
Silent Avenger




PostPosted: Fri Dec 07, 2007 10:49 pm   Post subject: Re: Left or right shift detection

There is no way that you can differentiate between the two shift keys in turing. The two shift keys output the same type of signal from the keyboard they just have two of them so that you only have to reach half way across the keyboard when capitalizing letters.
Ultrahex




PostPosted: Sat Dec 08, 2007 12:04 am   Post subject: Re: Left or right shift detection

In other programming languages there is ways to distinguish between the left and right shift keys, however i have not determined how to do so in turing. If anyone does, please post.
Silent Avenger




PostPosted: Sat Dec 08, 2007 7:02 am   Post subject: Re: Left or right shift detection

Ultrahex @ Sat Dec 08, 2007 12:04 am wrote:
In other programming languages there is ways to distinguish between the left and right shift keys, however i have not determined how to do so in turing. If anyone does, please post.

Can you do that because I remember reading in one of the text books at school that the shift keys output the same signal from the keyboard and it is impossible to distinguish between the two although it could have been wrong because I think the book was older than I am.
McKenzie




PostPosted: Sat Dec 08, 2007 9:52 am   Post subject: Re: Left or right shift detection

You sure can. I've done it in C years ago, but more recently, playing with pygame I get a value of 304 for the left shift, and 303 for the right shift. I remember with C that I had to do some assembly code to get the status. If I recall the keyboard driver treats them the same, so most basic input commands see them as the same.
Sponsor
Sponsor
Sponsor
sponsor
Silent Avenger




PostPosted: Sat Dec 08, 2007 7:14 pm   Post subject: Re: Left or right shift detection

Sweet now if I can only find a way to contact my old compsci teacher and tell him their text books are wrong. Oh well I'm sure they'll survive.
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  [ 9 Posts ]
Jump to:   


Style:  
Search: