Detecting left/right arrows on external keyboard?

Is there a way to detect a ‘left’ or ‘right’ arrow press on an external keyboard? The keyboard(key) function does not seem to react to them.

@Simeon hopefully arrow keys might get some attention sometime soon!

@piinthesky - have you tried printing out the key codes when the direction arrows are used.

Edit: course you have - ignore the above. This could be a nightmare with the different keyboards used. That’s why they have dedicated drivers on PCs.

@piinthesky As you well know, they don’t currently work in Codea but as long as iOS can connect to the keyboard it should have no problem handling them as all the keyboard events come through the same Apple API. We just need the support to be added by the Codea devs.

As far as the app is concerned, all keyboards are the same so drivers shouldn’t be an issue.

All, Just an update on this, I just purchased a Logitech K780 keyboard and connected via WiFi. The keyboard arrow keys are fully functional on my pad.

Bri_G so the keyboard(key) function reacts when you use the arrows?

I haven’t managed to get the keyboard(key) function to trigger with a keyboard using the smart connector but it works just fine inside the editor itself.

@piinthesky - yes it does. The keyboard has two modes - Bluetooth and WiFi via a dongle. So my Mac uses the dongle and the pad must be using Bluetooth. The keyboard has a numeric keypad, with arrows on it (which doesn’t work in moving the cursor) but it also has a separate set of four dedicated arrow keys - and they work. Only just got it so still learning about it. It has three dedicated cases which you can assign to connection toac, pc, pads or phones.

@Steppers - so far only used it within the editor my main reason for getting it, as it gives me a full editing screen. Have you an example of code to test response within a project?

yes, i want to use the arrows inside my codea programs via the keyboard(key) function

@Steppers @piinthesky - update, can not get a response from keyboard(key) but at least I have a full screen for editing.

@Bri_G Yeah, makes a really good difference being able to see more code. I can’t stand using the onscreen keyboard anymore.

Bumping this request. Still no keyboard event on the arrow keys.

@RonJeffries The arrow keys seem to work in the editor, but not in the keyboard function. So Codea can see them, just being blocked in the keyboard function.

Right. I wanna see any key I can hit. :slight_smile:

@RonJeffries The MKInput project on WebRepo should cover this with a little ObjC stuff (it’s pretty concise tbh).

You’ll get keyup & keydown ‘events’

I’ll have a look, thanks!

Seems like that could be easily added to a Codea update. The hard part is finding the time to do it with all the other more important updates.

Relatedly, there should be probably a locked article linking to the WebRepo at the top of the forum, with occasional updates.