Jump to content

Help with key binding

3 replies to this topic

#1 L1veAgainTeam

  • New Members
  • 2 posts
  • LocationWest Yorkshire, England

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 :)

#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

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.

#3 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

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.

#4 L1veAgainTeam

  • New Members
  • 2 posts
  • LocationWest Yorkshire, England

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 :)

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users