This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
L1veAgainTeam's profile picture

Help with key binding

Started by L1veAgainTeam, 01 March 2015 - 09:45 PM
L1veAgainTeam #1
Posted 01 March 2015 - 10:45 PM
Ok so i have an OS i've been working on for 2 years and felt like it'd be an amazing feature to add something like CTRL+R to refresh the desktop, now here's my problem, i can't find the code where computercraft binds CTRL+T to terminate a process in which i was going to use to help me do what i planned and was wondering if anyone else could help me to figure it out, any help is appreciated :)/>
Lyqyd #2
Posted 01 March 2015 - 11:07 PM
The Ctrl-R, Ctrl-S, and Ctrl-T key combinations are all detected on the Java side of things, so you won't be able to change their behavior, with the limited exception of ignoring the terminate events that Ctrl-T creates.
Bomb Bloke #3
Posted 02 March 2015 - 12:29 AM
You can detect other Ctrl + key combos, though: If you're holding Ctrl, then pressing a character key will generate a key event, but won't generate the corresponding char event like it usually would.

Thus if you queue a custom event after pulling a key event, you can determine whether Ctrl was being held down at the same time based on whether a char event comes out of the queue before your custom event does.
L1veAgainTeam #4
Posted 03 March 2015 - 06:35 PM
Ah okay then, i'll try what Bomb Bloke said and if that doesn't go too well i'll try other things, thanks anyways :)/>