Ruby UP/Down Arrows
Posted: Mon Jul 23, 2018 10:50 pm
Hi Folks
I wish to use the up/down arrow keys to move a selection up or down in a list. It seems that ruby doesn't accommodate key captures very easily. I've searched the entire internet ( ) and only found a couple of suggestions which I can't get to work.
So I decided to experiment (as you do).
It seems that the isKeyPressed method only responds when an event is taking place, ie a mouse click or in the 'solution' I've come up with, a trigger event (specifically a clock ticking).
Here's what I have so far:
Only problem so far is that it doesn't respond instantly as nine times out of ten the key will be pressed in between 'ticks'. (I don't want to use a fast clock to keep the CPU load down)
Does anyone have any suggestions to improve or is there a better way to do this?
If not then hopefully this may be useful to someone
Thanks in advance
Dave
I wish to use the up/down arrow keys to move a selection up or down in a list. It seems that ruby doesn't accommodate key captures very easily. I've searched the entire internet ( ) and only found a couple of suggestions which I can't get to work.
So I decided to experiment (as you do).
It seems that the isKeyPressed method only responds when an event is taking place, ie a mouse click or in the 'solution' I've come up with, a trigger event (specifically a clock ticking).
Here's what I have so far:
Only problem so far is that it doesn't respond instantly as nine times out of ten the key will be pressed in between 'ticks'. (I don't want to use a fast clock to keep the CPU load down)
Does anyone have any suggestions to improve or is there a better way to do this?
If not then hopefully this may be useful to someone
Thanks in advance
Dave