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

Username:   Password: 
 RegisterRegister   
 Getch not detecting Ctrl?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Fexter




PostPosted: Mon Mar 19, 2012 4:35 pm   Post subject: Getch not detecting Ctrl?

What is it you are trying to achieve?
I'm trying to make a program that detects when the user has pressed Ctrl, and can run certain functions depending on what other keys have been pressed.


What is the problem you are having?
Getch isn't returning anything when I press ctrl.


Describe what you have tried to solve this problem
I tried using Input.KeyDown (It works, but makes my program go extremely slow), searching on the turing documentation, and searching the forum.


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)


Turing:


var ch : string(1)
if hasch then
getch(ch)
if ch = KEY_CTRL then
put "Ctrl pushed"
end if
end if



Please specify what version of Turing you are using
I'm using both Turing 4.1 and Turing 4.1.1 for this.
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Mon Mar 19, 2012 5:06 pm   Post subject: RE:Getch not detecting Ctrl?

Ctrl is not a character and will not be found in the character stream to read. It will modify the output of the keyboard though, so you could watch for the "CTRL+C" key, for example.

code:

if ch = 3 then
 ... % Ctrl+c


http://compsci.ca/holtsoft/doc/keycodes.html
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
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  [ 2 Posts ]
Jump to:   


Style:  
Search: